ewoksndreg.transformation.scikitimage_backend.ShiftTransform#
- class ewoksndreg.transformation.scikitimage_backend.ShiftTransform(matrix=None, translation=None, dimensionality=2)[source]#
Bases:
ProjectiveTransform
- property dimensionality#
The dimensionality of the transformation.
- estimate(src, dst)[source]#
Estimate the transformation from a set of corresponding points.
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 = (a0*x + a1*y + a2) / (c0*x + c1*y + 1) Y = (b0*x + b1*y + b2) / (c0*x + c1*y + 1)
These equations can be transformed to the following form:
0 = a0*x + a1*y + a2 - c0*x*X - c1*y*X - X 0 = b0*x + b1*y + b2 - c0*x*Y - c1*y*Y - 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 = [[x y 1 0 0 0 -x*X -y*X -X] [0 0 0 x y 1 -x*Y -y*Y -Y] ... ... ] x.T = [a0 a1 a2 b0 b1 b2 c0 c1 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 normalised, square-rooted, then built into a diagonal matrix, by which A is multiplied.
In case of the affine transformation the coefficients c0 and c1 are 0. Thus the system of equations is:
A = [[x y 1 0 0 0 -X] [0 0 0 x y 1 -Y] ... ... ] x.T = [a0 a1 a2 b0 b1 b2 c3]
- Return type:
bool
Parameters#
- src(N, 2) array_like
Source coordinates.
- dst(N, 2) array_like
Destination coordinates.
- weights(N,) array_like, optional
Relative weight values for each pair of points.
Returns#
- successbool
True, if model estimation succeeds.
- param src:
- type src:
ndarray
- param dst:
- type dst:
ndarray
- property inverse#
Return a transform object representing the inverse.
- residuals(src, dst)#
Determine residuals of transformed destination coordinates.
For each transformed source coordinate the Euclidean distance to the respective destination coordinate is determined.
Parameters#
- src(N, 2) array
Source coordinates.
- dst(N, 2) array
Destination coordinates.
Returns#
- residuals(N,) array
Residual for coordinate.
- property translation#