bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / transform / _geometric / PolynomialTransform / from_estimate
classmethod
skimage.transform._geometric:PolynomialTransform.from_estimate
source: /dev/scikit-image/src/skimage/transform/_geometric.py :2331
Summary
Estimate the transformation from a set of corresponding points.
Extended Summary
You can determine the over-, well- and under-determined parameters with the total least-squares method.
Number of source and destination coordinates must match.
The transformation is defined as
X = sum[j=0:order]( sum[i=0:j]( a_ji * x**(j - i) * y**i )) Y = sum[j=0:order]( sum[i=0:j]( b_ji * x**(j - i) * y**i ))
These equations can be transformed to the following form
0 = sum[j=0:order]( sum[i=0:j]( a_ji * x**(j - i) * y**i )) - X 0 = sum[j=0:order]( sum[i=0:j]( b_ji * x**(j - i) * y**i )) - Y
which exist for each set of corresponding points, so we have a set of N * 2 equations. The coefficients appear linearly so we can write A x = 0, where
A = [[1 x y x**2 x*y y**2 ... 0 ... 0 -X] [0 ... 0 1 x y x**2 x*y y**2 -Y] ... ... ] x.T = [a00 a10 a11 a20 a21 a22 ... ann b00 b10 b11 b20 b21 b22 ... bnn c3]
In case of total least-squares the solution of this homogeneous system of equations is the right singular vector of A which corresponds to the smallest singular value normed by the coefficient c3.
Weights can be applied to each pair of corresponding points to indicate, particularly in an overdetermined system, if point pairs have higher or lower confidence or uncertainties associated with them. From the matrix treatment of least squares problems, these weight values are normalized, square-rooted, then built into a diagonal matrix, by which A is multiplied.
Parameters
src: array_like of shape (N, 2)Source coordinates.
dst: array_like of shape (N, 2)Destination coordinates.
order: int, optionalPolynomial order (number of coefficients is order + 1).
weights: array_like of shape (N,), optionalRelative weight values for each pair of points.
Returns
tf: Self or :class:`~.FailedEstimation`An instance of the transformation if the estimation succeeded. Otherwise, we return a special
FailedEstimationobject to signal a failed estimation. Testing the truth value of the failed estimation object will returnFalse. E.g.tf = PolynomialTransform.from_estimate(...) if not tf: raise RuntimeError(f"Failed estimation: {tf}")
Aliases
-
skimage.transform.PolynomialTransform.from_estimate