Skip to content

vector_angle_to_rigidVectorAngleToRigidVectorAngleToRigidvector_angle_to_rigidT_vector_angle_to_rigid🔗

Short description🔗

vector_angle_to_rigidVectorAngleToRigidVectorAngleToRigidvector_angle_to_rigidT_vector_angle_to_rigid — Compute a rigid affine transformation from points and angles.

Signature🔗

vector_angle_to_rigid( point.y Row1, point.x Column1, angle.rad Angle1, point.y Row2, point.x Column2, angle.rad Angle2, out hom_mat2d HomMat2D )void VectorAngleToRigid( const HTuple& Row1, const HTuple& Column1, const HTuple& Angle1, const HTuple& Row2, const HTuple& Column2, const HTuple& Angle2, HTuple* HomMat2D )static void HOperatorSet.VectorAngleToRigid( HTuple row1, HTuple column1, HTuple angle1, HTuple row2, HTuple column2, HTuple angle2, out HTuple homMat2D )def vector_angle_to_rigid( row_1: Union[float, int], column_1: Union[float, int], angle_1: Union[float, int], row_2: Union[float, int], column_2: Union[float, int], angle_2: Union[float, int] ) -> Sequence[float]

Herror T_vector_angle_to_rigid( const Htuple Row1, const Htuple Column1, const Htuple Angle1, const Htuple Row2, const Htuple Column2, const Htuple Angle2, Htuple* HomMat2D )

void HHomMat2D::VectorAngleToRigid( const HTuple& Row1, const HTuple& Column1, const HTuple& Angle1, const HTuple& Row2, const HTuple& Column2, const HTuple& Angle2 )

void HHomMat2D::VectorAngleToRigid( double Row1, double Column1, double Angle1, double Row2, double Column2, double Angle2 )

void HHomMat2D.VectorAngleToRigid( HTuple row1, HTuple column1, HTuple angle1, HTuple row2, HTuple column2, HTuple angle2 )

void HHomMat2D.VectorAngleToRigid( double row1, double column1, double angle1, double row2, double column2, double angle2 )

Description🔗

vector_angle_to_rigidVectorAngleToRigid computes a rigid affine transformation, i.e., a transformation consisting of a rotation and a translation, from a point correspondence and two corresponding angles and returns it as the homogeneous transformation matrix HomMat2DhomMat2Dhom_mat_2d. The matrix consists of 2 components: a rotation matrix R and a translation vector t (also see hom_mat2d_rotateHomMat2dRotate and hom_mat2d_translateHomMat2dTranslate):

\[\begin{eqnarray*} \textrm{HomMat2D} = \mvHomMatrixTwoDRotTrans{\mvRotationMatrixVar{}{}} {\mvTranslationVectorVar{}{}} = \mvHomMatrixTwoDRotTrans{\mvMatrixPlain{1 & 0 \\ 0 & 1}} {\mvTranslationVectorVar{}{}} \cdot \mvHomMatrixTwoDRotTrans{\mvRotationMatrixVar{}{}} {\mvVectorTwoDPlain{0}{0}} = \mvHomTranslationMatrixVar{}{} \cdot \mvHomRotationMatrixVar{}{} \end{eqnarray*}\]

The coordinates of the original point are passed in (Row1row1row_1,Column1column1column_1), while the corresponding angle is passed in Angle1angle1angle_1. The coordinates of the transformed point are passed in (Row2row2row_2,Column2column2column_2), while the corresponding angle is passed in Angle2angle2angle_2. The following equation describes the transformation of the point using homogeneous vectors:

\[\begin{eqnarray*} \mvHomVectorTwoD{\textrm{Row2}}{\textrm{Column2}} = \textrm{HomMat2D} \cdot \mvHomVectorTwoD{\textrm{Row1}}{\textrm{Column1}} \end{eqnarray*}\]

In particular, the operator vector_angle_to_rigidVectorAngleToRigid is useful to construct a rigid affine transformation from the results of the matching operators (e.g., find_ncc_modelFindNccModel), which transforms a reference image to the current image or (if the parameters are passed in reverse order) from the current image to the reference image.

HomMat2DhomMat2Dhom_mat_2d can be used directly with operators that transform data using affine transformations, e.g., affine_trans_imageAffineTransImage.

Execution information🔗

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

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

  • Processed without parallelization.

Parameters🔗

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

Row coordinate of the original point.

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

Column coordinate of the original point.

Angle1angle1angle_1 (input_control) angle.rad → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[float, int]Htuple (double / Hlong)

Angle of the original point.

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

Row coordinate of the transformed point.

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

Column coordinate of the transformed point.

Angle2angle2angle_2 (input_control) angle.rad → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[float, int]Htuple (double / Hlong)

Angle of the transformed point.

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

Output transformation matrix.

Example🔗

(HDevelop)

read_image (Image, 'face_masks/face_mask_01')
* Prepare NCC matching.
gen_rectangle2 (ROI, 616.5, 708.5, rad(-82.4054), 50, 35)
reduce_domain (Image, ROI, ImageReduced)
create_ncc_model (ImageReduced, 'auto', rad(0), rad(360), 'auto',\
                  'use_polarity', ModelID)
read_image (SearchImage, 'face_masks/face_mask_02')
find_ncc_model (SearchImage, ModelID, rad(0), rad(360), 0.7, 1, 0.5,\
                'true', 0, Row, Column, Angle, Score)
get_ncc_model_region (ModelRegion, ModelID)
gen_contour_region_xld (ModelRegion, ModelContours, 'border_holes')
* Create transformation matrix for found match.
vector_angle_to_rigid (0, 0, 0, Row, Column, Angle, HomMat2D)
affine_trans_contour_xld (ModelContours, ContoursAffineTrans, HomMat2D)

Combinations with other operators🔗

Combinations

Possible predecessors

get_ncc_model_regionGetNccModelRegion

Possible successors

hom_mat2d_invertHomMat2dInvert, affine_trans_imageAffineTransImage, affine_trans_regionAffineTransRegion, affine_trans_contour_xldAffineTransContourXld, affine_trans_polygon_xldAffineTransPolygonXld, affine_trans_point_2dAffineTransPoint2d

Alternatives

vector_to_rigidVectorToRigid

See also

vector_field_to_hom_mat2dVectorFieldToHomMat2d

Module🔗

Foundation