HALCON Reference Manual 10.0.2
Table of Contents / Transformations / 2D Transformations ClassesClassesClasses | | | Operators

affine_trans_pixelT_affine_trans_pixelaffine_trans_pixelAffineTransPixelAffineTransPixel (Operator)

Name

affine_trans_pixelT_affine_trans_pixelaffine_trans_pixelAffineTransPixelAffineTransPixel — Apply an arbitrary affine 2D transformation to pixel coordinates.

Signature

affine_trans_pixel( : : HomMat2D, Row, Col : RowTrans, ColTrans)

Herror T_affine_trans_pixel(const Htuple HomMat2D, const Htuple Row, const Htuple Col, Htuple* RowTrans, Htuple* ColTrans)

Herror affine_trans_pixel(const HTuple& HomMat2D, const HTuple& Row, const HTuple& Col, double* RowTrans, double* ColTrans)

Herror affine_trans_pixel(const HTuple& HomMat2D, const HTuple& Row, const HTuple& Col, HTuple* RowTrans, HTuple* ColTrans)

void HOperatorSetX.AffineTransPixel(
[in] VARIANT HomMat2d, [in] VARIANT Row, [in] VARIANT Col, [out] VARIANT* RowTrans, [out] VARIANT* ColTrans)

VARIANT HHomMat2DX.AffineTransPixel(
[in] VARIANT Row, [in] VARIANT Col, [out] VARIANT* ColTrans)

static void HOperatorSet.AffineTransPixel(HTuple homMat2D, HTuple row, HTuple col, out HTuple rowTrans, out HTuple colTrans)

void HHomMat2D.AffineTransPixel(HTuple row, HTuple col, out HTuple rowTrans, out HTuple colTrans)

void HHomMat2D.AffineTransPixel(double row, double col, out double rowTrans, out double colTrans)

Description

affine_trans_pixelaffine_trans_pixelaffine_trans_pixelAffineTransPixelAffineTransPixel applies an arbitrary affine 2D transformation, i.e., scaling, rotation, translation, and slant (skewing), to the input pixels (RowRowRowRowrow,ColColColColcol) and returns the resulting pixels in (RowTransRowTransRowTransRowTransrowTrans,ColTransColTransColTransColTranscolTrans); the input and output pixels are subpixel precise coordinates. The affine transformation is described by the homogeneous transformation matrix given in HomMat2DHomMat2DHomMat2DHomMat2DhomMat2D.

The difference between affine_trans_pixelaffine_trans_pixelaffine_trans_pixelAffineTransPixelAffineTransPixel and affine_trans_point_2daffine_trans_point_2daffine_trans_point_2dAffineTransPoint2dAffineTransPoint2d lies in the used coordinate system: affine_trans_pixelaffine_trans_pixelaffine_trans_pixelAffineTransPixelAffineTransPixel uses a coordinate system with origin in the upper left corner of the image, while affine_trans_point_2daffine_trans_point_2daffine_trans_point_2dAffineTransPoint2dAffineTransPoint2d uses the standard image coordinate system, whose origin lies in the middle of the upper left pixel and which is also used by operators like area_centerarea_centerarea_centerAreaCenterAreaCenter.

Applying affine_trans_pixelaffine_trans_pixelaffine_trans_pixelAffineTransPixelAffineTransPixel corresponds to the following chain of tansformations (input and output pixels as homogeneous vectors):

  / RowTrans \   / 1 0 -0.5 \              / 1 0 +0.5 \   / Row \
  | ColTrans | = | 0 1 -0.5 | * HomMat2D * | 0 1 +0.5 | * | Col |
  \    1     /   \ 0 0   1  /              \ 0 0   1  /   \  1  /

Hence,

  affine_trans_pixel (HomMat2D, Row, Col, RowTrans, ColTrans)

corresponds to the following operator sequence:

  affine_trans_point_2d (HomMat2D, Row+0.5, Col+0.5, RowTmp, ColTmp)
  RowTrans := RowTmp-0.5
  ColTrans := ColTmp-0.5

Parallelization

Parameters

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

Input transformation matrix.

RowRowRowRowrow (input_control)  point.x(-array) HTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong)

Input pixel(s) (row coordinate).

Default value: 64

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

ColColColColcol (input_control)  point.y(-array) HTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong)

Input pixel(s) (column coordinate).

Default value: 64

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

RowTransRowTransRowTransRowTransrowTrans (output_control)  point.x(-array) HTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double)

Output pixel(s) (row coordinate).

ColTransColTransColTransColTranscolTrans (output_control)  point.y(-array) HTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double)

Output pixel(s) (column coordinate).

Result

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

Possible Predecessors

hom_mat2d_translatehom_mat2d_translatehom_mat2d_translateHomMat2dTranslateHomMat2dTranslate, hom_mat2d_translate_localhom_mat2d_translate_localhom_mat2d_translate_localHomMat2dTranslateLocalHomMat2dTranslateLocal, hom_mat2d_scalehom_mat2d_scalehom_mat2d_scaleHomMat2dScaleHomMat2dScale, hom_mat2d_scale_localhom_mat2d_scale_localhom_mat2d_scale_localHomMat2dScaleLocalHomMat2dScaleLocal, hom_mat2d_rotatehom_mat2d_rotatehom_mat2d_rotateHomMat2dRotateHomMat2dRotate, hom_mat2d_rotate_localhom_mat2d_rotate_localhom_mat2d_rotate_localHomMat2dRotateLocalHomMat2dRotateLocal, hom_mat2d_slanthom_mat2d_slanthom_mat2d_slantHomMat2dSlantHomMat2dSlant, hom_mat2d_slant_localhom_mat2d_slant_localhom_mat2d_slant_localHomMat2dSlantLocalHomMat2dSlantLocal

Alternatives

affine_trans_point_2daffine_trans_point_2daffine_trans_point_2dAffineTransPoint2dAffineTransPoint2d

Module

Foundation


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