SimilarityTransform
-
class skimage.transform.SimilarityTransform(matrix=None, scale=None, rotation=None, translation=None)
[source] -
Bases:
skimage.transform._geometric.ProjectiveTransform
2D similarity transformation of the form:
..:math:
- X = a0 * x - b0 * y + a1 =
- = m * x * cos(rotation) - m * y * sin(rotation) + a1
- Y = b0 * x + a0 * y + b1 =
- = m * x * sin(rotation) + m * y * cos(rotation) + b1
where
m
is a zoom factor and the homogeneous transformation matrix is:[[a0 b0 a1] [b0 a0 b1] [0 0 1]]
Parameters: matrix : (3, 3) array, optional
Homogeneous transformation matrix.
scale : float, optional
Scale factor.
rotation : float, optional
Rotation angle in counter-clockwise direction as radians.
translation : (tx, ty) as array, list or tuple, optional
x, y translation parameters.
Attributes
params ((3, 3) array) Homogeneous transformation matrix. -
__init__(matrix=None, scale=None, rotation=None, translation=None)
[source]
-
estimate(src, dst)
[source] -
Set the transformation matrix with the explicit parameters.
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 - b0 * y + a1 Y = b0 * x + a0 * y + b1
These equations can be transformed to the following form:
0 = a0 * x - b0 * y + a1 - X 0 = b0 * x + a0 * y + b1 - 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 1 -y 0 -X] [y 0 x 1 -Y] ... ... ] x.T = [a0 a1 b0 b1 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.
Parameters: src : (N, 2) array
Source coordinates.
dst : (N, 2) array
Destination coordinates.
Returns: success : bool
True, if model estimation succeeds.
-
rotation
-
scale
-
translation
Please login to continue.