The best circle fitting algorithm

后端 未结 5 1327
-上瘾入骨i
-上瘾入骨i 2021-01-31 06:26

I need a very precise algorithm for fitting a circle to the set of data points (actually I need to determine the center). The data comes after the binarization and segmentation

5条回答
  •  天涯浪人
    2021-01-31 06:56

    To find circles' centers with subpixel accuracy if the radius of the circle is known (and constant), I use this approach:

    1. Take an image with a single circle (refferred to as marker below). Its radius should be the same as the radius of the circles you want to find.
    2. Detect edges (magnitude of the Sobel gradient, then some threshold to remove low-intensity edges), both in the test image and in the flipped marker image. I do not apply edge thinning at this stage and do not identify exact points on the edge.
    3. Cross-correlate edges of the test image with the edges of the flipped marker. You get some peaks where the centers are located.
    4. Find peaks' centers with subpixel accuracy. Center of mass or fitting a 2D Gaussian bell may work well.
    5. Add shifts which correspond to known position of the center of the circle in the marker.

    Otherwise, if points on the circle are known with sufficient accuracy, least mean squares fitting should solve the problem of finding the center (see @nikie's answer).

提交回复
热议问题