Ellipse implicit equation coefficients

2 ビュー (過去 30 日間)
Wajahat 2012 年 5 月 1 日
Hi I have a set of 2D points and I want to know the coefficients of the following implicit equation of the ellipse: Ax^2+2Bxy+Cy^2=1
Any idea?
Moreover, I have found the best fitting ellipse with its major, minor axes, center and orientation. Can I can use this information to find the above mentioned three coefficients (A,B and C)?
The implementations of ellipse fitting already available in Matlab Central use the general form of ellipse, I do not need coefficients for those.
Best Regards Wajahat


Richard Brown
Richard Brown 2012 年 5 月 1 日
First, if the centre is nonzero, then that form of the ellipse equation will not work. You need the more general quadratic form
(*) x^' * A * x + c' * x + d = 0
where A is a 2x2 symmetric matrix, c a 2x1 vector and d a scalar. Multiplying out gives the full equation
a_11 x^2 + 2a_12 xy + a_22 y^2 + c_1 x + c_2 y + d = 0
If you used my code: http://www.mathworks.com/matlabcentral/fileexchange/15125-fitellipse-m/ then what you get when you fit your ellipse is the centre z, the orientation of the major axis as a counterclockwise rotation from the x-axis alpha , and a and b the semimajor and semiminor axes respectively. Any of the other fitting codes probably return similar parameters.
These correspond to the following parametric equation for the ellipse (parametrised by theta in [0, 2\pi])
x = z + Q * [a * cos(theta); b * sin(theta)]
Q = [cos(alpha), -sin(alpha); sin(alpha) cos(alpha)]
All you need to do to get back to the quadratic form is to eliminate theta. First some algebra
diag([1/a, 1/b]) * Q'*(x - z) = [cos(theta); sin(theta)] = u
Using the fact that u'*u = 1,
(x - z)' * Q * diag([1/a^2, 1/b^2]) * Q' * (x - z) = 1
(x - z)' * A * (x - z) = 1
where A is symmetric. Expanding this out gives the required form:
x'*A*x - 2*z'*A*x + z'*A*z - 1 = 0
So linking back to my first equation (*), the MATLAB code for generating the matrices and vectors required are
Q = [cos(alpha), -sin(alpha); sin(alpha) cos(alpha)];
A = Q * diag([a^-2, b^-2]) * Q';
c = 2*A*z;
d = z'*A*z - 1;
  8 件のコメント
Wajahat 2012 年 5 月 2 日
Hi Richard
Thanks for the offer.
I have sent my data to your email( the one mentioned here on MatlabCentral) along with some sample images.
Best Regards


その他の回答 (0 件)


Find more on Get Started with Curve Fitting Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by