Approximate an similarity transformation from point correspondences.
vector_to_similarity approximates a similarity transformation, i.e., a transformation consisting of a scaling, a rotation, and a translation, from at least two point correspondences and returns it in form of the homogeneous transformation matrix HomMat2D. The matrix consists of 3 components: a scaling matrix S, a rotation matrix R, and a translation vector t (also see hom_mat2d_scale, hom_mat2d_rotate, and hom_mat2d_translate):
/ 1 0 tx \ / R00 R01 0 \ / Sx 0 0 \
HomMat2D = | R*S t | = | 0 1 ty | * | R10 R11 0 | * | 0 Sy 0 | = H(t) * H(R)
| 0 0 1 | \ 0 0 1 / \ 0 0 1 / \ 0 0 1 /
The point correspondences are passed in the tuples (Rows1, Columns1) and (Rows2,Columns2), where corresponding points must be at the same index positions in the tuples. If more than two point correspondences are passed the transformation is overdetermined. In this case, the returned transformation is the transformation that minimizes the distances between the original points (Rows1,Columns1) and the transformed points (Rows2,Columns2), as described in the following equation (points as homogeneous vectors):
|| / Rows2[i] \ / Rows1[i] \ ||^2
sum of all || | Columns2[i] | - HomMat2D * | Columns1[i] | || = minimum
|| \ 1 / \ 1 / ||
HomMat2D can be used directly with operators that transform data using affine transformations, e.g., affine_trans_image.
|
Rows1 (input_control) |
point.y-array -> real |
| Row coordinates of the original points. | |
|
Columns1 (input_control) |
point.x-array -> real |
| Column coordinates of the original points. | |
|
Rows2 (input_control) |
point.y-array -> real |
| Row coordinates of the transformed points. | |
|
Columns2 (input_control) |
point.x-array -> real |
| Column coordinates of the transformed points. | |
|
HomMat2D (output_control) |
affine2d-array -> real |
| Output transformation matrix. | |
| Number of elements: 6 | |
vector_to_similarity is reentrant and processed without parallelization.
affine_trans_image, affine_trans_region, affine_trans_contour_xld, affine_trans_polygon_xld, affine_trans_point_2d
vector_to_hom_mat2d, vector_to_rigid
Basic operators