Ask Your Question

Revision history [back]

How to get the number of pixels in an ROI c++?

Hello, I have a sample image, my goal is to find the number of red pixels (black if turned to binary) per circle. A sample output like:

Circle 1: 900
Circle 2: 400
Circle 3: 300

Here is the sample image: image description

I have been successful in using the countNonZero function for individually cropped circle and using an area of about 30*30 to get the results. However I want to use the base image and get ROIs for each circle then calculate the pixels. Thanks!