vector_to_aniso — Approximate an anisotropic similarity transformation from point
vector_to_aniso approximates an anisotropic similarity
transformation, i.e., a transformation consisting of a rotation, a
non-uniform scaling, and a translation, from at least three point
correspondences and returns it as the homogeneous transformation
HomMat2D. The matrix consists of 3 components: a
scaling matrix S with non-identical
scaling in the x and y directions, a rotation matrix
R, and a translation vector
t (also see
The point correspondences are passed in the tuples
Py) and (
corresponding points must be at the same index positions in the tuples.
The transformation is always overdetermined. Therefore, the returned
transformation is the transformation that minimizes the distances between
the original points (
Py) and the transformed points
Qy), as described in the following equation (points
as homogeneous vectors):
HomMat2D can be used directly with operators that transform data
using affine transformations, e.g.,
In an anisotropic similarity transformation, as defined above, the points
are first scaled and then rotated. Sometimes, a transformation in which
the points are first rotated and then scaled is useful. This kind of
transformation can be computed with
vector_to_aniso by passing
the point correspondences in the opposite order, i.e., the points
Py) are passed in the parameters
Qy) and vice versa. The resulting transformation
must then be inverted with
It should be noted that homogeneous transformation matrices refer to
a general right-handed mathematical coordinate system. If a
homogeneous transformation matrix is used to transform images,
regions, XLD contours, or any other data that has been extracted
from images, the row coordinates of the transformation must be
passed in the x coordinates, while the column coordinates must be
passed in the y coordinates. Consequently, the order of passing row
and column coordinates follows the usual order
Column). This convention is essential to
obtain a right-handed coordinate system for the transformation of
iconic data, and consequently to ensure in particular that rotations
are performed in the correct mathematical direction.
Furthermore, it should be noted that if a homogeneous transformation matrix is used to transform images, regions, XLD contours, or any other data that has been extracted from images, it is assumed that the origin of the coordinate system of the homogeneous transformation matrix lies in the upper left corner of a pixel. The image processing operators that return point coordinates, however, assume a coordinate system in which the origin lies in the center of a pixel. Therefore, to obtain a consistent homogeneous transformation matrix, 0.5 must be added to the point coordinates before computing the transformation.
X coordinates of the original points.
Y coordinates of the original points.
X coordinates of the transformed points.
Y coordinates of the transformed points.
Output transformation matrix.