Skip to content

affine_trans_point_2dAffineTransPoint2dAffineTransPoint2daffine_trans_point_2dT_affine_trans_point_2d🔗

Short description🔗

affine_trans_point_2dAffineTransPoint2dAffineTransPoint2daffine_trans_point_2dT_affine_trans_point_2d — Apply an arbitrary affine 2D transformation to points.

Signature🔗

affine_trans_point_2d( hom_mat2d HomMat2D, point.x Px, point.y Py, out point.x Qx, out point.y Qy )void AffineTransPoint2d( const HTuple& HomMat2D, const HTuple& Px, const HTuple& Py, HTuple* Qx, HTuple* Qy )static void HOperatorSet.AffineTransPoint2d( HTuple homMat2D, HTuple px, HTuple py, out HTuple qx, out HTuple qy )def affine_trans_point_2d( hom_mat_2d: Sequence[float], px: MaybeSequence[Union[float, int]], py: MaybeSequence[Union[float, int]] ) -> Tuple[Sequence[float], Sequence[float]]

def affine_trans_point_2d_s( hom_mat_2d: Sequence[float], px: MaybeSequence[Union[float, int]], py: MaybeSequence[Union[float, int]] ) -> Tuple[float, float]Herror T_affine_trans_point_2d( const Htuple HomMat2D, const Htuple Px, const Htuple Py, Htuple* Qx, Htuple* Qy )

HTuple HHomMat2D::AffineTransPoint2d( const HTuple& Px, const HTuple& Py, HTuple* Qy ) const

double HHomMat2D::AffineTransPoint2d( double Px, double Py, double* Qy ) const

HTuple HHomMat2D.AffineTransPoint2d( HTuple px, HTuple py, out HTuple qy )

double HHomMat2D.AffineTransPoint2d( double px, double py, out double qy )

Description🔗

affine_trans_point_2dAffineTransPoint2d applies an arbitrary affine 2D transformation, i.e., scaling, rotation, translation, and slant (skewing), to the input points (Pxpxpx,Pypypy) and returns the resulting points in (Qxqxqx,Qyqyqy). The affine transformation is described by the homogeneous transformation matrix given in HomMat2DhomMat2Dhom_mat_2d. This corresponds to the following equation (input and output points as homogeneous vectors):

\[\begin{eqnarray*} \mvHomVectorTwoD{\textrm{Qx}}{\textrm{Qy}} = \textrm{HomMat2D} \cdot \mvHomVectorTwoD{\textrm{Px}}{\textrm{Py}} \end{eqnarray*}\]

If the points to transform are specified in standard image coordinates, their row coordinates must be passed in Pxpxpx and their column coordinates in Pypypy. 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_identityHomMat2dIdentity, hom_mat2d_rotateHomMat2dRotate, hom_mat2d_translateHomMat2dTranslate, etc., or can be the result of operators like vector_angle_to_rigidVectorAngleToRigid.

For example, if HomMat2DhomMat2Dhom_mat_2d corresponds to a rigid transformation, i.e., if it consists of a rotation and a translation, the points are transformed as follows:

\[\begin{eqnarray*} \mvHomVectorTwoD{\textrm{Qx}}{\textrm{Qy}} \: = \: \mvHomMatrixTwoDRotTrans{\mvRotationMatrixVar{}{}} {\mvTranslationVectorVar{}{}} \cdot \mvHomVectorTwoD{\textrm{Px}}{\textrm{Py}} \: = \: \mvVectorTwoD{\mvRotationMatrixVar{}{} \cdot \mvVectorTwoD{\textrm{Px}}{\textrm{Py}} + \mvTranslationVectorVar{}{}}{1} \end{eqnarray*}\]

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Automatically parallelized on internal data level.

Parameters🔗

HomMat2DhomMat2Dhom_mat_2d (input_control) hom_mat2d → (real)HTuple (double)HHomMat2D, HTuple (double)Sequence[float]Htuple (double)

Input transformation matrix.

Pxpxpx (input_control) point.x(-array) → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)MaybeSequence[Union[float, int]]Htuple (double / Hlong)

Input point(s) (x or row coordinate).

Default: 6464
Suggested values: 0, 16, 32, 64, 128, 256, 512, 10240, 16, 32, 64, 128, 256, 512, 1024

Pypypy (input_control) point.y(-array) → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)MaybeSequence[Union[float, int]]Htuple (double / Hlong)

Input point(s) (y or column coordinate).

Default: 6464
Suggested values: 0, 16, 32, 64, 128, 256, 512, 10240, 16, 32, 64, 128, 256, 512, 1024

Qxqxqx (output_control) point.x(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Output point(s) (x or row coordinate).

Qyqyqy (output_control) point.y(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Output point(s) (y or column coordinate).

Result🔗

If the matrix HomMat2DhomMat2Dhom_mat_2d represents an affine transformation (i.e., not a projective transformation), affine_trans_point_2dAffineTransPoint2d returns 2 (H_MSG_TRUE). Otherwise, an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

hom_mat2d_translateHomMat2dTranslate, hom_mat2d_translate_localHomMat2dTranslateLocal, hom_mat2d_scaleHomMat2dScale, hom_mat2d_scale_localHomMat2dScaleLocal, hom_mat2d_rotateHomMat2dRotate, hom_mat2d_rotate_localHomMat2dRotateLocal, hom_mat2d_slantHomMat2dSlant, hom_mat2d_slant_localHomMat2dSlantLocal, hom_mat2d_reflectHomMat2dReflect, hom_mat2d_reflect_localHomMat2dReflectLocal

Possible successors

hom_mat2d_translateHomMat2dTranslate, hom_mat2d_translate_localHomMat2dTranslateLocal, hom_mat2d_scaleHomMat2dScale, hom_mat2d_scale_localHomMat2dScaleLocal, hom_mat2d_rotateHomMat2dRotate, hom_mat2d_rotate_localHomMat2dRotateLocal, hom_mat2d_slantHomMat2dSlant, hom_mat2d_slant_localHomMat2dSlantLocal, hom_mat2d_reflectHomMat2dReflect, hom_mat2d_reflect_localHomMat2dReflectLocal

Module🔗

Foundation