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

projective_trans_image_sizeT_projective_trans_image_sizeprojective_trans_image_sizeProjectiveTransImageSizeProjectiveTransImageSize (Operator)

Name

projective_trans_image_sizeT_projective_trans_image_sizeprojective_trans_image_sizeProjectiveTransImageSizeProjectiveTransImageSize — Apply a projective transformation to an image and specify the output image size.

Signature

projective_trans_image_size(Image : TransImage : HomMat2D, Interpolation, Width, Height, TransformRegion : )

Herror T_projective_trans_image_size(const Hobject Image, Hobject* TransImage, const Htuple HomMat2D, const Htuple Interpolation, const Htuple Width, const Htuple Height, const Htuple TransformRegion)

Herror projective_trans_image_size(Hobject Image, Hobject* TransImage, const HTuple& HomMat2D, const HTuple& Interpolation, const HTuple& Width, const HTuple& Height, const HTuple& TransformRegion)

HImage HImage::ProjectiveTransImageSize(const HTuple& HomMat2D, const HTuple& Interpolation, const HTuple& Width, const HTuple& Height, const HTuple& TransformRegion) const

HImageArray HImageArray::ProjectiveTransImageSize(const HTuple& HomMat2D, const HTuple& Interpolation, const HTuple& Width, const HTuple& Height, const HTuple& TransformRegion) const

void HOperatorSetX.ProjectiveTransImageSize(
[in] IHUntypedObjectX* Image, [out] IHUntypedObjectX*TransImage, [in] VARIANT HomMat2d, [in] VARIANT Interpolation, [in] VARIANT Width, [in] VARIANT Height, [in] VARIANT TransformRegion)

IHImageX* HImageX.ProjectiveTransImageSize(
[in] IHHomMat2DX* HomMat2d, [in] BSTR Interpolation, [in] Hlong Width, [in] Hlong Height, [in] BSTR TransformRegion)

IHImageX* HHomMat2DX.ProjectiveTransImageSize(
[in] IHImageX* Image, [in] BSTR Interpolation, [in] Hlong Width, [in] Hlong Height, [in] BSTR TransformRegion)

static void HOperatorSet.ProjectiveTransImageSize(HObject image, out HObject transImage, HTuple homMat2D, HTuple interpolation, HTuple width, HTuple height, HTuple transformRegion)

HImage HImage.ProjectiveTransImageSize(HHomMat2D homMat2D, string interpolation, int width, int height, string transformRegion)

HImage HHomMat2D.ProjectiveTransImageSize(HImage image, string interpolation, int width, int height, string transformRegion)

Description

projective_trans_image_sizeprojective_trans_image_sizeprojective_trans_image_sizeProjectiveTransImageSizeProjectiveTransImageSize applies the projective transformation (homography) determined by the homogeneous transformation matrix HomMat2DHomMat2DHomMat2DHomMat2DhomMat2D on the input image ImageImageImageImageimage and stores the result into the output image TransImageTransImageTransImageTransImagetransImage.

TransImageTransImageTransImageTransImagetransImage will be clipped at the output dimensions HeightHeightHeightHeightheightxWidthWidthWidthWidthwidth. Apart from this, projective_trans_image_sizeprojective_trans_image_sizeprojective_trans_image_sizeProjectiveTransImageSizeProjectiveTransImageSize is identical to its alternative version projective_trans_imageprojective_trans_imageprojective_trans_imageProjectiveTransImageProjectiveTransImage.

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 projective_trans_image_sizeprojective_trans_image_sizeprojective_trans_image_sizeProjectiveTransImageSizeProjectiveTransImageSize corresponds to the following chain of transformations, which is applied to each point (Row_i, Col_i) of the image (input and output pixels as homogeneous vectors):

  / RowTrans_i \   / 1 0 -0.5 \              / 1 0 +0.5 \   / Row_i \
  | ColTrans_i | = | 0 1 -0.5 | * HomMat2D * | 0 1 +0.5 | * | Col_i |
  \    1       /   \ 0 0   1  /              \ 0 0   1  /   \  1    /

As an effect, you might get unexpected results when creating projective transformations based on coordinates that are derived from the image, e.g., by operators like area_center_grayarea_center_grayarea_center_grayAreaCenterGrayAreaCenterGray. For example, if you use this operator to calculate the center of gravity of a rotationally symmetric image and then rotate the image around this point using hom_mat2d_rotatehom_mat2d_rotatehom_mat2d_rotateHomMat2dRotateHomMat2dRotate, the resulting image 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 projective_trans_image_sizeprojective_trans_image_sizeprojective_trans_image_sizeProjectiveTransImageSizeProjectiveTransImageSize:

  hom_mat2d_translate(HomMat2D, 0.5, 0.5, HomMat2DTmp)
  hom_mat2d_translate_local(HomMat2DTmp, -0.5, -0.5, HomMat2DAdapted)
  projective_trans_image_size(Image, TransImage, HomMat2DAdapted,
	               'bilinear', 'Width', 'Height', 'false')

projective_trans_image_sizeprojective_trans_image_sizeprojective_trans_image_sizeProjectiveTransImageSizeProjectiveTransImageSize can be executed on OpenCL devices if the input image does not exceed the maximum size of image objects of the selected device and the parameter TransformRegionTransformRegionTransformRegionTransformRegiontransformRegion is set to 'false'"false""false""false""false". The result can diverge slightly from that calculated on the CPU.

Parallelization

Parameters

ImageImageImageImageimage (input_object)  (multichannel-)image(-array) objectHImageHImageHImageXHobject (byte* / uint2* / real*) *allowed for compute devices

Input image.

TransImageTransImageTransImageTransImagetransImage (output_object)  (multichannel-)image(-array) objectHImageHImageHImageXHobject * (byte / uint2 / real)

Output image.

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

Homogeneous projective transformation matrix.

InterpolationInterpolationInterpolationInterpolationinterpolation (input_control)  string HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

Interpolation method for the transformation.

Default value: 'bilinear' "bilinear" "bilinear" "bilinear" "bilinear"

List of values: 'nearest_neighbor'"nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor", 'bilinear'"bilinear""bilinear""bilinear""bilinear"

WidthWidthWidthWidthwidth (input_control)  extent.x HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Output image width.

HeightHeightHeightHeightheight (input_control)  extent.y HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Output image height.

TransformRegionTransformRegionTransformRegionTransformRegiontransformRegion (input_control)  string HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

Should the domain of the input image also be transformed?

Default value: 'false' "false" "false" "false" "false"

List of values: 'true'"true""true""true""true", 'false'"false""false""false""false"

List of values (for compute devices): 'false'"false""false""false""false"

Possible Predecessors

vector_to_proj_hom_mat2dvector_to_proj_hom_mat2dvector_to_proj_hom_mat2dVectorToProjHomMat2dVectorToProjHomMat2d, hom_vector_to_proj_hom_mat2dhom_vector_to_proj_hom_mat2dhom_vector_to_proj_hom_mat2dHomVectorToProjHomMat2dHomVectorToProjHomMat2d, proj_match_points_ransacproj_match_points_ransacproj_match_points_ransacProjMatchPointsRansacProjMatchPointsRansac, proj_match_points_ransac_guidedproj_match_points_ransac_guidedproj_match_points_ransac_guidedProjMatchPointsRansacGuidedProjMatchPointsRansacGuided, hom_mat3d_projecthom_mat3d_projecthom_mat3d_projectHomMat3dProjectHomMat3dProject

See also

projective_trans_imageprojective_trans_imageprojective_trans_imageProjectiveTransImageProjectiveTransImage, projective_trans_contour_xldprojective_trans_contour_xldprojective_trans_contour_xldProjectiveTransContourXldProjectiveTransContourXld, projective_trans_regionprojective_trans_regionprojective_trans_regionProjectiveTransRegionProjectiveTransRegion, projective_trans_point_2dprojective_trans_point_2dprojective_trans_point_2dProjectiveTransPoint2dProjectiveTransPoint2d, projective_trans_pixelprojective_trans_pixelprojective_trans_pixelProjectiveTransPixelProjectiveTransPixel

Module

Foundation


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