ClassesClasses | | Operators

affine_trans_polygon_xldT_affine_trans_polygon_xldAffineTransPolygonXldAffineTransPolygonXld (Operator)

Name

affine_trans_polygon_xldT_affine_trans_polygon_xldAffineTransPolygonXldAffineTransPolygonXld — Apply an arbitrary affine transformation to XLD polygons.

Signature

affine_trans_polygon_xld(Polygons : PolygonsAffineTrans : HomMat2D : )

Herror T_affine_trans_polygon_xld(const Hobject Polygons, Hobject* PolygonsAffineTrans, const Htuple HomMat2D)

void AffineTransPolygonXld(const HObject& Polygons, HObject* PolygonsAffineTrans, const HTuple& HomMat2D)

HXLDPoly HXLDPoly::AffineTransPolygonXld(const HHomMat2D& HomMat2D) const

HXLDPoly HHomMat2D::AffineTransPolygonXld(const HXLDPoly& Polygons) const

static void HOperatorSet.AffineTransPolygonXld(HObject polygons, out HObject polygonsAffineTrans, HTuple homMat2D)

HXLDPoly HXLDPoly.AffineTransPolygonXld(HHomMat2D homMat2D)

HXLDPoly HHomMat2D.AffineTransPolygonXld(HXLDPoly polygons)

Description

affine_trans_polygon_xldaffine_trans_polygon_xldAffineTransPolygonXldAffineTransPolygonXldAffineTransPolygonXld applies an arbitrary affine transformation, i.e., scaling, rotation, translation, and slant (skewing), to the XLD polygons given in PolygonsPolygonsPolygonsPolygonspolygons and returns the transformed polygons in PolygonsAffineTransPolygonsAffineTransPolygonsAffineTransPolygonsAffineTranspolygonsAffineTrans. The affine transformation is described by the homogeneous transformation matrix given in HomMat2DHomMat2DHomMat2DHomMat2DhomMat2D. This matrix can be created using the operators hom_mat2d_identityhom_mat2d_identityHomMat2dIdentityHomMat2dIdentityHomMat2dIdentity, hom_mat2d_scalehom_mat2d_scaleHomMat2dScaleHomMat2dScaleHomMat2dScale, hom_mat2d_rotatehom_mat2d_rotateHomMat2dRotateHomMat2dRotateHomMat2dRotate, hom_mat2d_translatehom_mat2d_translateHomMat2dTranslateHomMat2dTranslateHomMat2dTranslate, etc., or be the result of operators like vector_angle_to_rigidvector_angle_to_rigidVectorAngleToRigidVectorAngleToRigidVectorAngleToRigid.

The components of the homogeneous transformation matrix are interpreted as follows: The row coordinate of the image corresponds to x and the column 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 XLD contours that are possibly referenced by PolygonsPolygonsPolygonsPolygonspolygons are neither transformed nor stored with the output polygons, since this is generally impossible without creating inconsistencies for the attributes of the XLD contours. Hence, operators that access the contours associated with a polygon, e.g., split_contours_xldsplit_contours_xldSplitContoursXldSplitContoursXldSplitContoursXld will not work correctly.

affine_trans_polygon_xldaffine_trans_polygon_xldAffineTransPolygonXldAffineTransPolygonXldAffineTransPolygonXld does not use the HALCON standard coordinate system (with the origin in the center of the upper left pixel), but instead uses the same coordinate system as in affine_trans_pixelaffine_trans_pixelAffineTransPixelAffineTransPixelAffineTransPixel, i.e., the origin lies in the upper left corner of the upper left pixel. Therefore, applying affine_trans_polygon_xldaffine_trans_polygon_xldAffineTransPolygonXldAffineTransPolygonXldAffineTransPolygonXld corresponds to a chain of transformations (see affine_trans_pixelaffine_trans_pixelAffineTransPixelAffineTransPixelAffineTransPixel), which is applied to each point of the polygon (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 polygon, e.g., by operators like area_center_xldarea_center_xldAreaCenterXldAreaCenterXldAreaCenterXld. For example, if you use this operator to calculate the center of gravity of a rotationally symmetric XLD polygon and then rotate the polygon around this point using hom_mat2d_rotatehom_mat2d_rotateHomMat2dRotateHomMat2dRotateHomMat2dRotate, the resulting polygon 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_polygon_xldaffine_trans_polygon_xldAffineTransPolygonXldAffineTransPolygonXldAffineTransPolygonXld:

  hom_mat2d_translate(HomMat2D, 0.5, 0.5, HomMat2DTmp)
  hom_mat2d_translate_local(HomMat2DTmp, -0.5, -0.5, HomMat2DAdapted)
  affine_trans_polygon_xld(Polygons, PolygonsAffineTrans, HomMat2DAdapted)

Execution Information

Parameters

PolygonsPolygonsPolygonsPolygonspolygons (input_object)  xld_poly(-array) objectHXLDPolyHXLDPolyHobject

Input XLD polygons.

PolygonsAffineTransPolygonsAffineTransPolygonsAffineTransPolygonsAffineTranspolygonsAffineTrans (output_object)  xld_poly(-array) objectHXLDPolyHXLDPolyHobject *

Transformed XLD polygons.

HomMat2DHomMat2DHomMat2DHomMat2DhomMat2D (input_control)  hom_mat2d HHomMat2D, HTupleHTupleHtuple (real) (double) (double) (double)

Input transformation matrix.

Result

If the matrix HomMat2DHomMat2DHomMat2DHomMat2DhomMat2D represents an affine transformation (i.e., not a projective transformation), affine_trans_polygon_xldaffine_trans_polygon_xldAffineTransPolygonXldAffineTransPolygonXldAffineTransPolygonXld 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>)SetSystem("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_identityHomMat2dIdentityHomMat2dIdentityHomMat2dIdentity, hom_mat2d_translatehom_mat2d_translateHomMat2dTranslateHomMat2dTranslateHomMat2dTranslate, hom_mat2d_rotatehom_mat2d_rotateHomMat2dRotateHomMat2dRotateHomMat2dRotate, hom_mat2d_scalehom_mat2d_scaleHomMat2dScaleHomMat2dScaleHomMat2dScale, hom_mat2d_reflecthom_mat2d_reflectHomMat2dReflectHomMat2dReflectHomMat2dReflect

See also

affine_trans_imageaffine_trans_imageAffineTransImageAffineTransImageAffineTransImage, affine_trans_regionaffine_trans_regionAffineTransRegionAffineTransRegionAffineTransRegion, affine_trans_contour_xldaffine_trans_contour_xldAffineTransContourXldAffineTransContourXldAffineTransContourXld

Module

Foundation


ClassesClasses | | Operators