<< Back to main page

MATLAB code for circle fitting algorithms

Created and tested with MATLAB version 7.    E-mail your questions and comments to Nikolai Chernov

Geometric circle fits

Algebraic circle fits

Levenberg-Marquardt fit in the "full" (a,b,R) space
    (perhaps the best geometric circle fit)

Levenberg-Marquardt fit in the "reduced" (a,b) space
    (may be a little faster than above in favorable cases)

Trust region fit in the "full" (a,b,R) space
    (a little more reliable but slower)

Spath fit
    (reliable but quite slow; not recommended)

Landau fit
    (heuristic and very slow; not recommended)

Chernov-Lesort fit
    (the only fit that converges from
    any initial guess, but slower that the Levenberg-Marquardt)

Note: every geometric fit must be supplied with an initial guess.
Use an algebraic fit for this purpose. We recommend Taubin fit.
Kasa fit     (the simplest and fastest fit, but biased
    toward small circles when an incomplete arc is observed)

Pratt fit:   SVD-based
    (optimized for stability)
    (optimized for speed)

Taubin fit:   SVD-based
    (optimized for stability)
    (optimized for speed)
           (perhaps the best algebraic circle fit)

Hyper fit:   SVD-based
    (optimized for stability)
          (optimized for speed)

Nievergelt fit
    (poor, not recommended)

Gander-Golub-Strebel fit
    (poor, not recommended)

Specialized ("exotic") circle fits

Consistent circle fits

Riemann fit
  (by Strandlie, Wroldsen, Fruhwirth, and Lillekjendlie)
       Original version
       Equivalent version using algebraic parameters
(pretty accurate in most cases, but not fully tested in all cases)

Inversion-based fit
  (by Rusu, Tico, Kuosmanen, and Delp)
       Non-iterative version
       Iterative version
Non-iterative version works only for circles passing near (0,0).
Iterative version is more stable, but sometimes diverges.

Karimaki fit
       Original version (without corrective step)
       Original version (with corrective step)
       Equivalent version using algebraic parameters
Without corrective step, less accurate than any algebraic fit.
With corrective step, similar to the Pratt fit, but slightly less precise.

Note: Inversion-based fits and Karimaki fits must be supplied
with a pole (a point near which the circle presumably passes).
You can use any data point for that purpose.
These fits return estimates that converge to the true values of
parameter as  n → ∞. They work better for larger samples.

Kukush-Markovsky-van Huffel fit

Consistent version of Kasa fit