Ellipse Fit

Version 1.1.0.0 (1,22 ko) par Tal Hendel
Given a set of points (x, y) this function returns the best fit ellipse.
6,8K téléchargements
Mise à jour 13 déc. 2008

Aucune licence

Usage:

[semimajor_axis, semiminor_axis, x0, y0, phi] = ellipse_fit(x, y)

Input:
x - a vector of x measurements
y - a vector of y measurements

Output:

semimajor_axis - Magnitude of ellipse longer axis
semiminor_axis - Magnitude of ellipse shorter axis
x0 - x coordinate of ellipse center
y0- y coordinate of ellipse center
phi - Angle of rotation in radians with respect to
the x-axis

Algorithm used:

Given the quadratic form of an ellipse:
a*x^2 + 2*b*x*y + c*y^2 + 2*d*x + 2*f*y + g = 0 (1)
we need to find the best (in the Least Square sense) parameters a,b,c,d,f,g.
To transform this into the usual way in which such estimation problems are presented,
divide both sides of equation (1) by a and then move x^2 to the other side. This gives us:
2*b'*x*y + c'*y^2 + 2*d'*x + 2*f'*y + g' = -x^2 (2)
where the primed parametes are the original ones divided by a. Now the usual estimation technique is used where the problem is presented as:
M * p = b, where M = [2*x*y y^2 2*x 2*y ones(size(x))],
p = [b c d e f g], and b = -x^2. We seek the vector p, given by:
p = pseudoinverse(M) * b.
From here on I used formulas (19) - (24) in Wolfram Mathworld:
http://mathworld.wolfram.com/Ellipse.html

Citation pour cette source

Tal Hendel (2024). Ellipse Fit (https://www.mathworks.com/matlabcentral/fileexchange/22423-ellipse-fit), MATLAB Central File Exchange. Récupéré le .

Compatibilité avec les versions de MATLAB
Créé avec R2006b
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux
Remerciements

Inspiré par : Circle fit

A inspiré : Ellipse Fit (Taubin method), Ellipse Fit (Direct method)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Publié le Notes de version
1.1.0.0

Added input and output explanations to description part.

1.0.0.0