Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Yes, your approach is the right way to go:

  1. get your circles, e.g. via cv::HoughCircles : cv::HougCircles(image, circles); , see the example http://docs.opencv.org/modules/imgproc/doc/feature_detection.html?highlight=houghcircle#cv2.HoughCircles .

  2. for circle in circles:

    • get the region of interest in your image:

      cv::Mat roi = img(cv::Range(circle[1]-circle[2], circle[1]+circle[2]+1), cv::Range(circle[0]-circle[2], circle[0]+circle[2]+1))

    • create your mask w. the roi-size: cv::Mat1b mask(roi.rows, roi.cols);

    • compute the mean: cv::Scalar mean = cv::mean(roi, mask); --> now the Scalar contains the mean values for each channel (i.e. mean[0] is the mean of your blue channel, etc.)