Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
2 added 515 characters in body
source | link

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

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:

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

Currently, I'm trying to detect circles without HoughTransform

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

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?

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

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:

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

Currently, I'm trying to detect circles without HoughTransform

1
source | link

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

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?