There is a module of scikit that deals with the problem of finding in ellipse through a set of data points: https://scikit-image.org/docs/dev/api/skimage.measure.html#skimage.measure.EllipseModel. Please use this module instead of my code.
This old python program fits an ellipse through a given set of points. This ellipse is optimal in the least squares sense. I just keep my code and documentation in case people are interested in obtaining a basic understanding how to attack the problem.
If you still like to use it, as it is available under the MIT license: You can use it in any way you like, but don’t blame me if you don’t like the result.
I will no longer maintain this code, unless the scikit module will disappear.
fitEllipse.org
contains the source codefitEllipse.pdf
is the pdf made fromfitEllipse.org
to make the maths readable.fitEllipse.py
contains the algorithm, obtained by tanglingfitEllipse.org
fit_ellipse_example.py
shows an example on how to use the coderun_fit_ellipse.py
makes many test cases.
Before moving this code to github, it was available at http://nicky.vanforeest.com/misc/fitEllipse/fitEllipse.html.