Conic Fitting

The fitting of a parabola, circle, or ellipse can clearly be generalized to any arbitrarily oriented conic (Section 1.7).

Let $(x_i, y_i)^{\top}$, with $i=1, \ldots, n$, be noisy points belonging to the locus to be estimated.

Equation (1.92) can be rewritten in the form

\begin{displaymath}
\mathbf{a}_i^{\top}\boldsymbol\beta = 0
\end{displaymath} (4.123)

where

\begin{displaymath}
\mathbf{a}_i =
\left\{
x_i^2,\,
x_i y_i,\,
y_i^2,\,
x_i,\,
y_i,\,
1
\right\}
\end{displaymath}

and

\begin{displaymath}
\boldsymbol\beta =
\left\{
a,\,
b,\,
c,\,
d,\,
e,\,
f
\right\}.
\end{displaymath}

It is therefore clear that the parameters $\boldsymbol\beta$ of a general conic can be estimated by solving a homogeneous problem of the form

\begin{displaymath}
\mathbf{A}\boldsymbol\beta = 0
\end{displaymath}

with six unknowns.

Since the system admits the trivial solution $\boldsymbol\beta=\mathbf{0}$, a suitable normalization constraint must be introduced, and the parameters estimated by minimizing a cost function of the form


\begin{displaymath}
S =
\sum_{i=1}^{n}
\left(
\mathbf{a}_i^{\top}\boldsymbol\beta
\right)^2.
\end{displaymath} (4.124)

This solution minimizes an algebraic error, not the geometric point-to-conic distance, and is therefore not generally an optimal estimator.

An alternative formulation specifically for direct least-squares ellipse fitting can be found in (FPF99).

Finally, to estimate how close a point is to the conic, or to approximate the geometric point-to-conic distance, the Sampson error can be used (Section 4.3.8). This requires the gradient of the implicit function associated with the conic defined by Equation (1.92), which has the form


\begin{displaymath}
\nabla f(x,y)
=
\left(
2ax + by + d,\,
bx + 2cy + e
\right).
\end{displaymath} (4.125)

Paolo medici
2026-10-19