Circle center & radius detection at OpenCV

34 views Asked by At

enter image description here

I want to detect circle center & radius. ( C#, OpenCV2 )

I tried to find it using Canny Edge, Laplace Edge, BinarizerMethod.

I found wrong position and radius.

How can I improve it?

a_circle = new IplImage(src.Size, BitDepth.U8, 3);
Cv.Copy(src, a_circle);

a_gray = new IplImage(src.Size, BitDepth.U8, 1);

Cv.CvtColor(src, a_gray, ColorConversion.BgrToGray);
Cv.Smooth(a_gray, a_gray, SmoothType.Gaussian, 9);

CvMemStorage a_Storage = new CvMemStorage();
CvSeq<CvCircleSegment> circles = Cv.HoughCircles(a_gray, a_Storage, HoughCirclesMethod.Gradient, 1, 100, a_p_edge, a_p_center, 0, 0);

foreach (CvCircleSegment item in circles)
{
    Cv.DrawCircle(a_gray, item.Center, (int)item.Radius, CvColor.White, 3);

    point_radius = (int)item.Radius;
    point_centerX = (int)item.Center.X;
    point_centerY = (int)item.Center.Y;
}

I tried to find it using Canny Edge, Laplace Edge, BinarizerMethod.

How can I find the circle center & radius?

0

There are 0 answers