Apply an arbitrary affine 2D transformation to points.
affine_trans_point_2d applies an arbitrary affine 2D transformation, i.e., scaling, rotation, translation, and slant (skewing), to the input points (Px,Py) and returns the resulting points in (Qx,Qy). The affine transformation is described by the homogeneous transformation matrix given in HomMat2D. This corresponds to the following equation (input and output points as homogeneous vectors):
/ Qx \ / Px \ | Qy | = HomMat2D * | Py | \ 1 / \ 1 /
If the points to transform are specified in standard image coordinates, their row coordinates must be passed in Px and their column coordinates in Py. This is necessary to obtain a right-handed coordinate system for the image. In particular, this assures that rotations are performed in the correct direction. Note that the (x,y) order of the matrices quite naturally corresponds to the usual (row,column) order for coordinates in the image.
The transformation matrix can be created using the operators hom_mat2d_identity, hom_mat2d_rotate, hom_mat2d_translate, etc., or can be the result of operators like vector_angle_to_rigid.
For example, if HomMat2D corresponds to a rigid transformation, i.e., if it consists of a rotation and a translation, the points are transformed as follows:
/ Qx \ / Px \ / / Px \ \ | Qy | = | R t | * | Py | = | R*\ Py / + t | \ 1 / | 0 0 1 | \ 1 / \ 1 /
|
HomMat2D (input_control) |
hom_mat2d-array -> real |
| Input transformation matrix. | |
|
Px (input_control) |
point.x(-array) -> real / integer |
| Input point(s) (x or row coordinate). | |
| Default value: 64 | |
| Suggested values: 0, 16, 32, 64, 128, 256, 512, 1024 | |
|
Py (input_control) |
point.y(-array) -> real / integer |
| Input point(s) (y or column coordinate). | |
| Default value: 64 | |
| Suggested values: 0, 16, 32, 64, 128, 256, 512, 1024 | |
|
Qx (output_control) |
point.x(-array) -> real |
| Output point(s) (x or row coordinate). | |
|
Qy (output_control) |
point.y(-array) -> real |
| Output point(s) (y or column coordinate). | |
If the matrix HomMat2D represents an affine transformation (i.e., not a projective transformation), affine_trans_point_2d returns 2 (H_MSG_TRUE). Otherwise, an exception is raised.
affine_trans_point_2d is reentrant and processed without parallelization.
hom_mat2d_translate, hom_mat2d_translate_local, hom_mat2d_scale, hom_mat2d_scale_local, hom_mat2d_rotate, hom_mat2d_rotate_local, hom_mat2d_slant, hom_mat2d_slant_local
hom_mat2d_translate, hom_mat2d_translate_local, hom_mat2d_scale, hom_mat2d_scale_local, hom_mat2d_rotate, hom_mat2d_rotate_local, hom_mat2d_slant, hom_mat2d_slant_local
Foundation