# HoughCircles finds anything but circles

I use emgucv (an opencv wrapper) to find circles in image.

To test it, I drew a circle on image in photoshop.

I used HoughCircles algorithm with a very small distance between circles' centers and big range of radiuses.

It found a lot of circles where no one should be and didn't find the one I drew.

Am I missing something?

Original Image: Result of circles detection:

Source:

static Image<Bgr, byte> detect_circles(Image<Bgr, byte> original)
{
Image<Bgr, byte> res = original.Copy();
CircleF[] circles =
res
.Convert<Gray, byte>()
//.SmoothGaussian(9)
.HoughCircles(new Gray(100), new Gray(100), 1, 0.1, 1, 150)[0];
res = res
.Convert<Gray, byte>()
//.SmoothGaussian(9)
.Convert<Bgr, byte>();
foreach (CircleF circle in circles)
res.Draw(circle, new Bgr(Color.Cyan), 2);
return res;
}


Parameters of HoughCircles are described here http://www.emgu.com/wiki/files/1.4.0.0/html/6f78c3d8-fb1a-5983-2862-549c49019d49.htm

I understand why it detects circles many times - the minimal distance between centers is really small, but why isn't the yellow circle detected?

EDIT Lowering radius to 75 or less eliminates all circles.

I played with tresholds and set parameters to HoughCircles(new Gray(200), new Gray(75), 1, 10, 5, 150)[0];, but results are still poor with house image:

However, it detects black and white circle:

Currently, I'm trying to detect circles without HoughTransform

• Try lowering your maxRadius parameter to about 50. I'm wondering whether HoughCircles only returns the top, say, 100 circles... and it's finding way too many. You might also want to run the image through the Canny edge detector and see what Hough is working from. – Peter K. Sep 11 '15 at 12:25
• Can you try a simpler image and then give use the results. Like what do you get with this? static.comicvine.com/uploads/original/7/75052/… – ruoho ruotsi Sep 11 '15 at 21:04
• Thank you for suggestions, but they do not seem to work. Canny(50,100) and Canny(100,50) both give clear image of circle on the roof. – user2136963 Sep 12 '15 at 10:28