How to find an ellipse, given five points?

Is there a way to find the parameters $$A, B, \alpha, x_0, y_0$$ for the ellipse formula $$\frac{(x \cos\alpha+y\sin\alpha-x_0\cos\alpha-y_0\sin\alpha)^2}{A^2}+\frac{(-x \sin\alpha+y\cos\alpha+x_0\sin\alpha-y_0\cos\alpha)^2}{B^2}=1$$ given five points of the ellipse?

-
To translate the parameters of what jrajchgot presented into yours, i refer you to math world equation 15 and following. Or suck it up and deal with the implicit equation directly! – Peter Sheldrick Jun 27 '12 at 21:53

3 Answers

What about using the DLT : http://en.wikipedia.org/wiki/Direct_linear_transformation ?

The solution is the null-space of the matrix

$$\left(\begin{array} & p_1^2 & p_1q_1 & q_1^2 & p_1 & q_1 & 1 \\ p_2^2 & p_2q_2 & q_2^2 & p_2 & q_2 & 1 \\ p_3^2 & p_3q_3 & q_3^2 & p_3 & q_3 & 1 \\ p_4^2 & p_4q_4 & q_4^2 & p_4 & q_4 & 1 \\ p_5^2 & p_5q_5 & q_5^2 & p_5 & q_5 & 1 \end{array}\right)$$

which can be found using SVD decomposition.

-
This is the only answer that actually gives concrete and practical instructions. Thank you! – Torsten Bronger Jun 17 '15 at 14:20

What jrajchgot said, but written as a determinant... The conic section passing through the five points $(p_1,q_1),\dots,(p_5,q_5)$ has equation $ax^2+bxy+cy^2+dx+ey+f=0$ which may be written as the determinant equation $$\left|\begin{array} &x^2 & xy & y^2 & x & y & 1 \\ p_1^2 & p_1q_1 & q_1^2 & p_1 & q_1 & 1 \\ p_2^2 & p_2q_2 & q_2^2 & p_2 & q_2 & 1 \\ p_3^2 & p_3q_3 & q_3^2 & p_3 & q_3 & 1 \\ p_4^2 & p_4q_4 & q_4^2 & p_4 & q_4 & 1 \\ p_5^2 & p_5q_5 & q_5^2 & p_5 & q_5 & 1 \end{array}\right| = 0$$

-

Here is one way to determine the equation of an ellipse given 5 points. (From there, you can work out the parameters that you want.)

Every ellipse has the form $ax^2+bxy+cy^2+dx+ey+f=0$. We'll find $a,b,c,d,e,f$ given 5 points.

Let $(p_1,q_1),\dots,(p_5,q_5)$ be your 5 points. Consider the following linear equations in the variables $a,b,c,d,e,f$: $ax^2+bxy+cy^2+dx+ey+f=0$, $ap_1^2+bp_1q_1+cq_1^2+dp_1+eq_1+f = 0$,...,$ap_5^2+bp_5q_5+cq_5^2+dp_5+eq_5+f = 0$. Note that we're treating $x^2, xy,y^2,x,y,1$ as coefficients in the first equation. Similarly, $p_i^2,p_iq_i, q_i^2, p_i,q_i,1$ are coefficients in the remaining 5 equations.

Since all 5 points lie on the same ellipse, the above linear equations must have common solution. From this, we see that the equation of the ellipse is given by setting the determinant of the matrix of coefficients of the above 6 equations to $0$.

-
I don't get it. I have five linear equations using the five points. What do I have to do with the sixth equation? And what should I do with the determinant containing the values x and y? – tangens Jul 1 '12 at 14:37
The 6th equation is also linear when you treat the monomials in $x$ and $y$ as the coefficients. Take the determinant of the matrix (see GEdgar's answer below) and set it equal to zero. This should give you an equation in $x$ and $y$. This is the equation of your ellipse. You can then rearrange it to put it in any form that you like. – jrajchgot Jul 1 '12 at 18:11