I have set of points and want to fit ellipse to this set. I have found only function which fits ellipse in least squares sense. In this set of points there are some noise points which should not be taken to ellipse fitting.

I want some references to algorithms which eliminate noisy points and fit ellipse to set of points.


2 Answers 2


This site has code to fit an ellipse, plus an explanation of the algorithm.


If the data is just "noisy", this should work fine. If there are a relatively few "wild" points in the input, they probably won't influence the result very much. You can filter them out after doing a first trial fitting.

Anyway, try this code, and see if it works for you.


Too long to comment:

A quick look around suggests that 'least median of squares' is the route to go, and the preeminent paper on it is by Roth and Levine [G. Roth and M.D. Levine. Extracting geometric primitives. CVGIP: Image Understanding, 58(1):1-22, 1993.]. Unfortunately, I could not find this article. A second reference (which I also could not find) might be [P. Rousseeuw and A. Leroy. Robust Regression and Outlier Detection. Wiley, 1987.]

I think this is the way to go because of a circuitous route. Firstly, page 22 of this presentation does it, and references this paper. This paper by Rosin about ellipse fitting and about the effect of outliers on least squares in particular mentions 'least median of squares' as a good alternative, and references both Roth and Levine, and Rousseeuw and Leroy as well. Unfortunately, Rosin's paper itself seems of limited use.

Other methods are mentioned in Rosin's paper as well. I hope this helps - good luck.

  • $\begingroup$ So I thought rather about some algorithms in more implementable forms or implemented so far. Reference-request tag was not added by my. Of coure thanks for effort and papers, but I'm looking for something I could check fast if it is working for me. $\endgroup$
    – krzych
    May 31, 2012 at 12:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .