Ellipse fitting in python?

Fernando Perez fperez528 at yahoo.com
Wed Jul 14 18:46:40 EDT 2004


John J. Lee wrote:

> oneelkruns at obvious.com (Ron Kneusel) writes:
> 
>> Is there a python package out there that supports fitting a set of 2D
>> points to an ellipse?  I haven't been able to find one.
> 
> This is a set of points with some noise (scatter), right?
> 
> A not-very-thoughtful answer: a sledgehammer method is to throw an
> implementation of a standard nonlinear least-squares algorithm at the
> problem.  For example, SciPy contains a wrapper of MINPACK's nonlinear
> LS solver .  There are several implementations of the same
> (Levenburg-Marquardt) algorithm in pure Python floating around, too.

A quick comment in case it's not obvious: an ellipse is not a function in
Cartesian coordinates, and most standard LS solvers expect a function.  So
it's probably best to convert things over to polar before feeding the data to
the LS solver.

f



More information about the Python-list mailing list