1 | initial version |
Yes, your approach is the right way to go:
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 .
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);