# colour.algebra.ellipse_fitting#

colour.algebra.ellipse_fitting(a: ArrayLike, method: Union[Literal['Halir 1998'], str] = 'Halir 1998') [source]#

Return the coefficients of the implicit second-order polynomial/quadratic curve that fits given point array $$a$$ using given method.

The implicit second-order polynomial is expressed as follows:

$$F\left(x, y\right)$$ = ax^2 + bxy + cy^2 + dx + ey + f = 0

with an ellipse-specific constraint such as $$b^2 -4ac < 0$$ and where $$a, b, c, d, e, f$$ are coefficients of the ellipse and $$F\left(x, y\right)$$ are coordinates of points lying on it.

Parameters
• a (ArrayLike) – Point array $$a$$ to be fitted.

• method (Union[Literal['Halir 1998'], str]) – Computation method.

Returns

Coefficients of the implicit second-order polynomial/quadratic curve that fits given point array $$a$$.

Return type

numpy.ndarray

References

[HF98]

Examples

>>> a = np.array([[2, 0], [0, 1], [-2, 0], [0, -1]])
>>> ellipse_fitting(a)
array([ 0.2425356...,  0.        ,  0.9701425...,  0.        ,  0.        ,
-0.9701425...])
>>> ellipse_coefficients_canonical_form(ellipse_fitting(a))
array([-0., -0.,  2.,  1.,  0.])
`