Just over a year ago, I highlighted in this blog a useful bit of code for fitting circles to data. I pointed out that I have had numerous opportunities to use the code over the years, and that I have had good success with it.
That blog entry sparked some interesting comments, including an intriguing one from Nikolai Chernov. Now, I readily admit to being naive about the topic. If you search the File Exchange for the words "fit circle," you'll find at least 9 different relevant submissions for peforming the task. Without additional information, you're pretty much on your own to figure out which one to use. What struck me about Nikolai's comment was that not only did he reveal the name of the method implemented in Izhak's code (it's referred to as the "Kasa method"), he also described the conditions under which it was a reasonable approach ("it works well when points cover a large part of the circle but is heavily biased when points are restricted to a small arc"). With a link to his UAB website, Nikolai shared his impressive body of work on circle-fitting and ellipse-fitting, and provided access to his m-code implementations thereof.
In a follow-up email, I asked Nikolai to put his files on the File Exchange; his work was too good not to share! Happily, he was quick to comply with my request. Nikolai's suite of fitting functions is Brett's choice for this week's Pick of the Week.
Each of the five files (Taubin, Pratt, and Kasa methods for fitting circles; and Direct and Taubin methods for fitting ellipses) includes references, and detailed notes on the relative strengths and weaknesses of the approach. (By the way, the "Taubin Ellipse Method" will fit hyperbolas, too, if that conic section better approximates the data.)
As always, your comments are welcome, and appreciated!
Get the MATLAB code
Published with MATLAB® 7.9
Comments are closed.