colour.algebra.ellipse_fitting¶
-
colour.algebra.
ellipse_fitting
(a, method='Halir 1998')[source]¶ Returns 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:
:math:`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 (array_like) – Point array \(a\) to be fitted.
method (unicode, optional) – {‘Halir 1998’}, Computation method.
- Returns
Coefficients of the implicit second-order polynomial/quadratic curve that fits given point array \(a\).
- Return type
ndarray
References
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.])