Skip to content

projective_trans_contour_xldprojective_trans_contour_xldProjectiveTransContourXldProjectiveTransContourXldprojective_trans_contour_xldT_projective_trans_contour_xld🔗

Short description🔗

projective_trans_contour_xldprojective_trans_contour_xldProjectiveTransContourXldProjectiveTransContourXldprojective_trans_contour_xldT_projective_trans_contour_xld — Apply a projective transformation to an XLD contour.

Signature🔗

projective_trans_contour_xld( xld_cont Contours, out xld_cont ContoursProjTrans, hom_mat2d HomMat2D )projective_trans_contour_xld( Contours : ContoursProjTrans : HomMat2D : )void ProjectiveTransContourXld( const HObject& Contours, HObject* ContoursProjTrans, const HTuple& HomMat2D )static void HOperatorSet.ProjectiveTransContourXld( HObject contours, out HObject contoursProjTrans, HTuple homMat2D )def projective_trans_contour_xld( contours: HObject, hom_mat_2d: Sequence[float] ) -> HObject

Herror T_projective_trans_contour_xld( const Hobject Contours, Hobject* ContoursProjTrans, const Htuple HomMat2D )

HXLDCont HXLDCont::ProjectiveTransContourXld( const HHomMat2D& HomMat2D ) const

HXLDCont HHomMat2D::ProjectiveTransContourXld( const HXLDCont& Contours ) const

HXLDCont HXLDCont.ProjectiveTransContourXld( HHomMat2D homMat2D )

HXLDCont HHomMat2D.ProjectiveTransContourXld( HXLDCont contours )

Description🔗

projective_trans_contour_xldProjectiveTransContourXld applies the projective transformation specified by the homogeneous matrix HomMat2DhomMat2Dhom_mat_2d on the contours in Contourscontourscontours and returns the transformed contours in ContoursProjTranscontoursProjTranscontours_proj_trans.

For creation and interpretation details of this matrix see also projective_trans_imageProjectiveTransImage.

Attention🔗

The used coordinate system is the same as in affine_trans_pixelAffineTransPixel. This means that in fact not HomMat2DhomMat2Dhom_mat_2d is applied but a modified version. Therefore, applying projective_trans_contour_xldProjectiveTransContourXld corresponds to the following chain of transformations, which is applied to each point \((Row_{i}, Col_{i})\) of the contour (input and output pixels as homogeneous vectors):

\[\begin{eqnarray*} \mvHomVectorTwoD{RowTrans_{i}}{ColTrans_{i}} = \mvHomMatrixTwoDElements{1 & 0 & - 0.5 \\ 0 & 1 & - 0.5} \cdot \textrm{HomMat2D} \cdot \mvHomMatrixTwoDElements{1 & 0 & + 0.5 \\ 0 & 1 & + 0.5} \cdot \mvHomVectorTwoD{Row_{i}}{Col_{i}} \end{eqnarray*}\]

As an effect, you might get unexpected results when creating projective transformations based on coordinates that are derived from the contour, e.g., by operators like area_center_xldAreaCenterXld. For example, if you use this operator to calculate the center of gravity of a rotationally symmetric XLD contour and then rotate the contour around this point using hom_mat2d_rotateHomMat2dRotate, the resulting contour will not lie on the original one. In such a case, you can compensate this effect by applying the following translations to HomMat2DhomMat2Dhom_mat_2d before using it in projective_trans_contour_xldProjectiveTransContourXld:

 
hom_mat2d_translate(HomMat2D, 0.5, 0.5, HomMat2DTmp)
hom_mat2d_translate_local(HomMat2DTmp, -0.5, -0.5, HomMat2DAdapted)
projective_trans_contour_xld(Contours, ContoursAffineTrans, HomMat2DAdapted)

For an explanation of the different 2D coordinate systems used in HALCON, see the introduction of chapter Transformations / 2D Transformations.

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🔗

Contourscontourscontours (input_object) xld_cont(-array) → objectobjectHObjectHXLDContHObjectHobject

Input contours.

ContoursProjTranscontoursProjTranscontours_proj_trans (output_object) xld_cont(-array) → objectobjectHObjectHXLDContHObjectHobject *

Output contours.

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

Homogeneous projective transformation matrix.

Combinations with other operators🔗

Combinations

Possible predecessors

vector_to_proj_hom_mat2dVectorToProjHomMat2d, hom_vector_to_proj_hom_mat2dHomVectorToProjHomMat2d, proj_match_points_ransacProjMatchPointsRansac, proj_match_points_ransac_guidedProjMatchPointsRansacGuided, hom_mat3d_projectHomMat3dProject

See also

projective_trans_imageProjectiveTransImage, projective_trans_image_sizeProjectiveTransImageSize, projective_trans_regionProjectiveTransRegion, projective_trans_point_2dProjectiveTransPoint2d, projective_trans_pixelProjectiveTransPixel

Module🔗

Foundation