I’m having the same problem issued in these two links: one, two. I need to calculate pixel intensity average on a small ROI in an image.
I selected the ROI and copied the image in it, so now I need to calculate pixel average intensity, avoiding a loop on all of the pixels.
The answers provided in the links suggest to use CvScalar c = cvAvg(img); but I can’t find the equivalent, using the C++ interface.
Can you please point it out to me? I couldn’t find it in the documentation!
I provide the code snippet solving the problem: