I would need to fit a given ellipse to a set of points and I know its size and orientation. In other words, I want to find the best translation of a given ellipse to fit a set of points. I have implemented a least squares fit like in this post : How to find the best fit ellipse to a given set of 2D points? but how to include this known ellipse shape ?
This is what I did already :
Let's pose an ellipse with center $(h, k)$ and semiaxes a and b, and tilt $\theta$. $(a,b)$ and $\theta$ are known and I am looking for the best (h,k) given a set of of $n$ two-dimensional points $\{(x_i, y_i), i=1,.., n\}$.
I used the conic equation,
$$ A x^2 + B xy + C y^2 + D x + E y + F = 0 $$
with the parametric to conic equations I have A, B and C known and $$ A = (b\cos\theta) ^2 + (a\sin\theta)^2 $$ $$ B = -2\cos\theta\sin\theta(a^2-b^2) $$ $$ C = (b\sin\theta) ^2 + (a\cos\theta)^2 $$
So I have a linear system $ G a = b $
where $ a = [D, E, F]^T$, and
$ G = \begin{bmatrix} x_1 && y_1 && 1 \\ x_2 && y_2 && 1 \\ x_3 && y_3 && 1 \\ \vdots \\ x_n && y_n && 1 \end{bmatrix}\hspace{5pt}, \hspace{25pt} b = \begin{bmatrix} - (Ax_1^2 +Bx_1y_1 + Cy_1^2) \\ - (Ax_2^2 +Bx_2y_2 + Cy_2^2) \\ - (Ax_3^2 +Bx_3y_2 + Cy_3^2) \\ \vdots \\ - (Ax_n^2 +Bx_ny_n + Cy_n^2) \end{bmatrix} $
By solving the equation I find an ellipse which definitely fit my set of points, but it also changes slightly the shape of my given ellipse, which is not what I want.
Any idea ? Thanks