| Table of Contents / Transformations / 2D Transformations | Operators |
affine_trans_pixel — Apply an arbitrary affine 2D transformation to pixel coordinates.
affine_trans_pixel applies an arbitrary affine 2D transformation, i.e., scaling, rotation, translation, and slant (skewing), to the input pixels (Row,Col) and returns the resulting pixels in (RowTrans,ColTrans); the input and output pixels are subpixel precise coordinates. The affine transformation is described by the homogeneous transformation matrix given in HomMat2D.
The difference between affine_trans_pixel and affine_trans_point_2d lies in the used coordinate system: affine_trans_pixel uses a coordinate system with origin in the upper left corner of the image, while affine_trans_point_2d uses the standard image coordinate system, whose origin lies in the middle of the upper left pixel and which is also used by operators like area_center.
Applying affine_trans_pixel corresponds to the following chain of tansformations (input and output pixels as homogeneous vectors):
/ RowTrans \ / 1 0 -0.5 \ / 1 0 +0.5 \ / Row \ | ColTrans | = | 0 1 -0.5 | * HomMat2D * | 0 1 +0.5 | * | Col | \ 1 / \ 0 0 1 / \ 0 0 1 / \ 1 /
Hence,
affine_trans_pixel (HomMat2D, Row, Col, RowTrans, ColTrans)
corresponds to the following operator sequence:
affine_trans_point_2d (HomMat2D, Row+0.5, Col+0.5, RowTmp, ColTmp) RowTrans := RowTmp-0.5 ColTrans := ColTmp-0.5
Input transformation matrix.
Input pixel(s) (row coordinate).
Default value: 64
Suggested values: 0, 16, 32, 64, 128, 256, 512, 1024
Input pixel(s) (column coordinate).
Default value: 64
Suggested values: 0, 16, 32, 64, 128, 256, 512, 1024
Output pixel(s) (row coordinate).
Output pixel(s) (column coordinate).
If the matrix HomMat2D represents an affine transformation (i.e., not a projective transformation), affine_trans_pixel returns 2 (H_MSG_TRUE). Otherwise, an exception is raised.
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
| Table of Contents / Transformations / 2D Transformations | Operators |
| HALCON Reference Manual 10.0.2 | Copyright © 1996-2011 MVTec Software GmbH |