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: enter image description here Result of circles detection: enter image description here


static Image<Bgr, byte> detect_circles(Image<Bgr, byte> original)
    Image<Bgr, byte> res = original.Copy();
    CircleF[] circles =
        .Convert<Gray, byte>()
        .HoughCircles(new Gray(100), new Gray(100), 1, 0.1, 1, 150)[0];
    res = res
        .Convert<Gray, byte>()
        .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/

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:

enter image description here However, it detects black and white circle: enter image description here

Currently, I'm trying to detect circles without HoughTransform

  • 2
    $\begingroup$ 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. $\endgroup$ – Peter K. Sep 11 '15 at 12:25
  • $\begingroup$ 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/… $\endgroup$ – ruoho ruotsi Sep 11 '15 at 21:04
  • $\begingroup$ 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. $\endgroup$ – user2136963 Sep 12 '15 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.