Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can do a threshold to first get all of the circles from the background.

Find contours and determine which are circles based on shape similarity etc.

Then use each contour to form a mask for each circle.

Then you can use basic averages for each contour to assess it's colour.

The inRange function is another option for fast segmentation by known colour.

  • Threshold/InRange
  • FindContours
  • ForEach contour, create an image mask and draw one contour.
  • Get average pixel value for image, with mask, for each contour.
  • Compare returned cv::Scalar to see if it is similar to green or black.

Also, only green circles will appear in the green channel of the RGB image. Black is 0 in all channels.