Calculate Ellipse From Points?

Solution 1:

Finding parameters

An ellipse (and in fact any conic section) is described by an equation of the form

$$ax^2+by^2+cxy+dx+ey+f=0$$

Any multiple of this equation describes the same ellipse. The parameters $a$ through $f$ can be found up to that multiple by knowing $5$ points on the ellipse:

$$\begin{pmatrix} x_1^2 & y_1^2 & x_1y_1 & x_1 & y_1 & 1 \\ x_2^2 & y_2^2 & x_2y_2 & x_2 & y_2 & 1 \\ x_3^2 & y_3^2 & x_3y_3 & x_3 & y_3 & 1 \\ x_4^2 & y_4^2 & x_4y_4 & x_4 & y_4 & 1 \\ x_5^2 & y_5^2 & x_5y_5 & x_5 & y_5 & 1 \\ \end{pmatrix} \cdot \begin{pmatrix} a \\ b \\ c \\ d \\ e \\ f \end{pmatrix} =\begin{pmatrix} 0 \\ 0 \\ 0 \\ 0 \\ 0 \end{pmatrix} $$

If you have more than five data points, you may choose any five of them. If your data points are not perfectly accurate, then look into Ellipse fitting methods.

Changing the representation

To turn the parameters you found into center, radii and orientation you can follow the steps which I outlined in this answer.