HALCON Reference Manual 10.0.2
Table of Contents / XLD / Geometric Transformations ClassesClassesClasses | | | Operators

affine_trans_contour_xldT_affine_trans_contour_xldaffine_trans_contour_xldAffineTransContourXldAffineTransContourXld (Operator)

Name

affine_trans_contour_xldT_affine_trans_contour_xldaffine_trans_contour_xldAffineTransContourXldAffineTransContourXld — Apply an arbitrary affine 2D transformation to XLD contours.

Signature

affine_trans_contour_xld(Contours : ContoursAffinTrans : HomMat2D : )

Herror T_affine_trans_contour_xld(const Hobject Contours, Hobject* ContoursAffinTrans, const Htuple HomMat2D)

Herror affine_trans_contour_xld(Hobject Contours, Hobject* ContoursAffinTrans, const HTuple& HomMat2D)

HXLDCont HXLDCont::AffineTransContourXld(const HTuple& HomMat2D) const

HXLDContArray HXLDContArray::AffineTransContourXld(const HTuple& HomMat2D) const

void HOperatorSetX.AffineTransContourXld(
[in] IHUntypedObjectX* Contours, [out] IHUntypedObjectX*ContoursAffinTrans, [in] VARIANT HomMat2d)

IHXLDContX* HXLDContX.AffineTransContourXld([in] IHHomMat2DX* HomMat2d)

IHXLDContX* HHomMat2DX.AffineTransContourXld([in] IHXLDContX* Contours)

static void HOperatorSet.AffineTransContourXld(HObject contours, out HObject contoursAffinTrans, HTuple homMat2D)

HXLDCont HXLDCont.AffineTransContourXld(HHomMat2D homMat2D)

HXLDCont HHomMat2D.AffineTransContourXld(HXLDCont contours)

Description

affine_trans_contour_xldaffine_trans_contour_xldaffine_trans_contour_xldAffineTransContourXldAffineTransContourXld applies an arbitrary affine 2D transformation, i.e., scaling, rotation, translation, and slant (skewing), to the XLD contours given in ContoursContoursContoursContourscontours and returns the transformed contours in ContoursAffinTransContoursAffinTransContoursAffinTransContoursAffinTranscontoursAffinTrans. The affine transformation is described by the homogeneous transformation matrix given in HomMat2DHomMat2DHomMat2DHomMat2DhomMat2D, which can be created using the operators hom_mat2d_identityhom_mat2d_identityhom_mat2d_identityHomMat2dIdentityHomMat2dIdentity, hom_mat2d_scalehom_mat2d_scalehom_mat2d_scaleHomMat2dScaleHomMat2dScale, hom_mat2d_rotatehom_mat2d_rotatehom_mat2d_rotateHomMat2dRotateHomMat2dRotate, hom_mat2d_translatehom_mat2d_translatehom_mat2d_translateHomMat2dTranslateHomMat2dTranslate, etc., or be the result of operators like vector_angle_to_rigidvector_angle_to_rigidvector_angle_to_rigidVectorAngleToRigidVectorAngleToRigid.

The components of the homogeneous transformation matrix are interpreted as follows: The row coordinate of the image corresponds to x and the col coordinate corresponds to y of the coordinate system in which the transformation matrix was defined. 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.

Attention

The used coordinate system is the same as in affine_trans_pixelaffine_trans_pixelaffine_trans_pixelAffineTransPixelAffineTransPixel. This means that in fact not HomMat2DHomMat2DHomMat2DHomMat2DhomMat2D is applied but a modified version. Therefore, applying affine_trans_contour_xldaffine_trans_contour_xldaffine_trans_contour_xldAffineTransContourXldAffineTransContourXld corresponds to a chain of transformations (see affine_trans_pixelaffine_trans_pixelaffine_trans_pixelAffineTransPixelAffineTransPixel), which is applied to each point of the contour (input and output pixels as homogeneous vectors). As an effect, you might get unexpected results when creating affine transformations based on coordinates that are derived from the contour, e.g., by operators like area_center_xldarea_center_xldarea_center_xldAreaCenterXldAreaCenterXld. 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_rotatehom_mat2d_rotatehom_mat2d_rotateHomMat2dRotateHomMat2dRotate, 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 HomMat2DHomMat2DHomMat2DHomMat2DhomMat2D before using it in affine_trans_contour_xldaffine_trans_contour_xldaffine_trans_contour_xldAffineTransContourXldAffineTransContourXld:

  hom_mat2d_translate(HomMat2D, 0.5, 0.5, HomMat2DTmp)
  hom_mat2d_translate_local(HomMat2DTmp, -0.5, -0.5, HomMat2DAdapted)
  affine_trans_contour_xld(Contours, ContoursAffinTrans, HomMat2DAdapted)

Parallelization

Parameters

ContoursContoursContoursContourscontours (input_object)  xld_cont(-array) objectHXLDContHXLDContHXLDContXHobject

Input XLD contours.

ContoursAffinTransContoursAffinTransContoursAffinTransContoursAffinTranscontoursAffinTrans (output_object)  xld_cont(-array) objectHXLDContHXLDContHXLDContXHobject *

Transformed XLD contours.

HomMat2DHomMat2DHomMat2DHomMat2DhomMat2D (input_control)  hom_mat2d-array HHomMat2D, HTupleHTupleHHomMat2DX, VARIANTHtuple (real) (double) (double) (double) (double)

Input transformation matrix.

Result

If the matrix HomMat2DHomMat2DHomMat2DHomMat2DhomMat2D represents an affine transformation (i.e., not a projective transformation), affine_trans_contour_xldaffine_trans_contour_xldaffine_trans_contour_xldAffineTransContourXldAffineTransContourXld returns 2 (H_MSG_TRUE). If the input is empty the behavior can be set via set_system(::'no_object_result',<Result>:)set_system("no_object_result",<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>). If necessary, an exception is raised.

Possible Predecessors

hom_mat2d_identityhom_mat2d_identityhom_mat2d_identityHomMat2dIdentityHomMat2dIdentity, hom_mat2d_translatehom_mat2d_translatehom_mat2d_translateHomMat2dTranslateHomMat2dTranslate, hom_mat2d_rotatehom_mat2d_rotatehom_mat2d_rotateHomMat2dRotateHomMat2dRotate, hom_mat2d_scalehom_mat2d_scalehom_mat2d_scaleHomMat2dScaleHomMat2dScale

See also

affine_trans_imageaffine_trans_imageaffine_trans_imageAffineTransImageAffineTransImage, affine_trans_regionaffine_trans_regionaffine_trans_regionAffineTransRegionAffineTransRegion

Module

Foundation


Table of Contents / XLD / Geometric Transformations ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH