问题
I'm currently using EmguCV to run shape detection on an image of a shooting range target:
But no matter my settings in the code (below):
double cannyThreshold = 180;
double circleAccumulatorThreshold = 170;
CircleF[] circles = CvInvoke.HoughCircles(uimage, HoughType.Gradient, 2.0, 1.0, cannyThreshold, circleAccumulatorThreshold, 5);
I can only seem to find three circles, of which one is wrong.
Am I going about this incorrectly? I'm using the default example for shape detection included with Rev3.0 EmguCV.
回答1:
- Find edges first (see Sobel operator or Canny for example)
- Find contours, after that contours will represent circles
- Filter contours by area
- Use minEnclosingCircle for each contour to get center and radius.
来源:https://stackoverflow.com/questions/34190594/detecting-circles-within-an-image