ClassesClassesClassesClasses | | | | Operators

projective_trans_imageT_projective_trans_imageProjectiveTransImageprojective_trans_imageProjectiveTransImageProjectiveTransImage (Operator)

Name

projective_trans_imageT_projective_trans_imageProjectiveTransImageprojective_trans_imageProjectiveTransImageProjectiveTransImage — Apply a projective transformation to an image.

Signature

projective_trans_image(Image : TransImage : HomMat2D, Interpolation, AdaptImageSize, TransformDomain : )

Herror T_projective_trans_image(const Hobject Image, Hobject* TransImage, const Htuple HomMat2D, const Htuple Interpolation, const Htuple AdaptImageSize, const Htuple TransformDomain)

Herror projective_trans_image(Hobject Image, Hobject* TransImage, const HTuple& HomMat2D, const HTuple& Interpolation, const HTuple& AdaptImageSize, const HTuple& TransformDomain)

HImage HImage::ProjectiveTransImage(const HTuple& HomMat2D, const HTuple& Interpolation, const HTuple& AdaptImageSize, const HTuple& TransformDomain) const

HImageArray HImageArray::ProjectiveTransImage(const HTuple& HomMat2D, const HTuple& Interpolation, const HTuple& AdaptImageSize, const HTuple& TransformDomain) const

void ProjectiveTransImage(const HObject& Image, HObject* TransImage, const HTuple& HomMat2D, const HTuple& Interpolation, const HTuple& AdaptImageSize, const HTuple& TransformDomain)

HImage HImage::ProjectiveTransImage(const HHomMat2D& HomMat2D, const HString& Interpolation, const HString& AdaptImageSize, const HString& TransformDomain) const

HImage HImage::ProjectiveTransImage(const HHomMat2D& HomMat2D, const char* Interpolation, const char* AdaptImageSize, const char* TransformDomain) const

HImage HHomMat2D::ProjectiveTransImage(const HImage& Image, const HString& Interpolation, const HString& AdaptImageSize, const HString& TransformDomain) const

HImage HHomMat2D::ProjectiveTransImage(const HImage& Image, const char* Interpolation, const char* AdaptImageSize, const char* TransformDomain) const

void HOperatorSetX.ProjectiveTransImage(
[in] IHUntypedObjectX* Image, [out] IHUntypedObjectX*TransImage, [in] VARIANT HomMat2d, [in] VARIANT Interpolation, [in] VARIANT AdaptImageSize, [in] VARIANT TransformDomain)

IHImageX* HImageX.ProjectiveTransImage(
[in] IHHomMat2DX* HomMat2d, [in] BSTR Interpolation, [in] BSTR AdaptImageSize, [in] BSTR TransformDomain)

IHImageX* HHomMat2DX.ProjectiveTransImage(
[in] IHImageX* Image, [in] BSTR Interpolation, [in] BSTR AdaptImageSize, [in] BSTR TransformDomain)

static void HOperatorSet.ProjectiveTransImage(HObject image, out HObject transImage, HTuple homMat2D, HTuple interpolation, HTuple adaptImageSize, HTuple transformDomain)

HImage HImage.ProjectiveTransImage(HHomMat2D homMat2D, string interpolation, string adaptImageSize, string transformDomain)

HImage HHomMat2D.ProjectiveTransImage(HImage image, string interpolation, string adaptImageSize, string transformDomain)

Description

projective_trans_imageprojective_trans_imageProjectiveTransImageprojective_trans_imageProjectiveTransImageProjectiveTransImage applies the projective transformation (homography) determined by the homogeneous transformation matrix HomMat2DHomMat2DHomMat2DHomMat2DHomMat2DhomMat2D on the input image ImageImageImageImageImageimage and stores the result into the output image TransImageTransImageTransImageTransImageTransImagetransImage.

If the parameter AdaptImageSizeAdaptImageSizeAdaptImageSizeAdaptImageSizeAdaptImageSizeadaptImageSize ist set to 'false'"false""false""false""false""false", TransImageTransImageTransImageTransImageTransImagetransImage will have the same size as ImageImageImageImageImageimage; if AdaptImageSizeAdaptImageSizeAdaptImageSizeAdaptImageSizeAdaptImageSizeadaptImageSize is 'true'"true""true""true""true""true", the output image size will be automatically adapted so that all non-negative points of the transformed image are visible.

The parameter InterpolationInterpolationInterpolationInterpolationInterpolationinterpolation determines, which interpolation method is used to determine the gray values of the output image. For InterpolationInterpolationInterpolationInterpolationInterpolationinterpolation = 'nearest_neighbor'"nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor", the gray value is determined from the nearest pixel in the input image. This mode is very fast, but also leads to the typical “jagged” appearance for large enlargements of the image. For InterpolationInterpolationInterpolationInterpolationInterpolationinterpolation = 'bilinear'"bilinear""bilinear""bilinear""bilinear""bilinear", the gray values are interpolated bilinearly, leading to longer runtimes, but also to significantly improved results.

The parameter TransformDomainTransformDomainTransformDomainTransformDomainTransformDomaintransformDomain can be used to determine whether the domain of ImageImageImageImageImageimage is also transformed. Since the transformation of the domain costs runtime, this parameter should be used to specify whether this is desired or not. If TransformDomainTransformDomainTransformDomainTransformDomainTransformDomaintransformDomain is set to 'false'"false""false""false""false""false" the domain of the input image is ignored and the complete image is transformed.

The projective transformation matrix could for example be created using the operator vector_to_proj_hom_mat2dvector_to_proj_hom_mat2dVectorToProjHomMat2dvector_to_proj_hom_mat2dVectorToProjHomMat2dVectorToProjHomMat2d.

In a homography the points to be projected are represented by homogeneous vectors of the form (x,y,w). A Euclidean point can be derived as (x',y') = (x/w,y/w).

Just like in affine_trans_imageaffine_trans_imageAffineTransImageaffine_trans_imageAffineTransImageAffineTransImage, x represents the row coordinate while y represents the column coordinate in projective_trans_imageprojective_trans_imageProjectiveTransImageprojective_trans_imageProjectiveTransImageProjectiveTransImage. With this convention, affine transformations are a special case of projective transformations in which the last row of HomMat2DHomMat2DHomMat2DHomMat2DHomMat2DhomMat2D is of the form (0,0,c).

For images of type 'byte'"byte""byte""byte""byte""byte" or 'uint2'"uint2""uint2""uint2""uint2""uint2" the system parameter 'int_zooming'"int_zooming""int_zooming""int_zooming""int_zooming""int_zooming" selects between fast calculation in fixed point arithmetics ('int_zooming'"int_zooming""int_zooming""int_zooming""int_zooming""int_zooming" = 'true'"true""true""true""true""true") and highly accurate calculation in floating point arithmetics ('int_zooming'"int_zooming""int_zooming""int_zooming""int_zooming""int_zooming" = 'false'"false""false""false""false""false"). Especially for InterpolationInterpolationInterpolationInterpolationInterpolationinterpolation = 'bilinear'"bilinear""bilinear""bilinear""bilinear""bilinear", however, fixed point calculation can lead to minor gray value deviations since the faster algorithm achieves an accuracy of no more than 1/16 pixels. Therefore, when applying large scales 'int_zooming'"int_zooming""int_zooming""int_zooming""int_zooming""int_zooming" = 'false'"false""false""false""false""false" is recommended.

Attention

The used coordinate system is the same as in affine_trans_pixelaffine_trans_pixelAffineTransPixelaffine_trans_pixelAffineTransPixelAffineTransPixel. This means that in fact not HomMat2DHomMat2DHomMat2DHomMat2DHomMat2DhomMat2D is applied but a modified version. Therefore, applying projective_trans_imageprojective_trans_imageProjectiveTransImageprojective_trans_imageProjectiveTransImageProjectiveTransImage 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_grayAreaCenterGrayarea_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_rotateHomMat2dRotatehom_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 HomMat2DHomMat2DHomMat2DHomMat2DHomMat2DhomMat2D before using it in projective_trans_imageprojective_trans_imageProjectiveTransImageprojective_trans_imageProjectiveTransImageProjectiveTransImage:

  hom_mat2d_translate(HomMat2D, 0.5, 0.5, HomMat2DTmp)
  hom_mat2d_translate_local(HomMat2DTmp, -0.5, -0.5, HomMat2DAdapted)
  projective_trans_image(Image, TransImage, HomMat2DAdapted,
	               'bilinear', 'false', 'false')

projective_trans_imageprojective_trans_imageProjectiveTransImageprojective_trans_imageProjectiveTransImageProjectiveTransImage 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 TransformDomainTransformDomainTransformDomainTransformDomainTransformDomaintransformDomain is set to 'false'"false""false""false""false""false". The result can diverge slightly from that calculated on the CPU.

Parallelization

Parameters

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

Input image.

TransImageTransImageTransImageTransImageTransImagetransImage (output_object)  (multichannel-)image(-array) objectHImageHImageHImageHImageXHobject * (byte / uint2 / real)

Output image.

HomMat2DHomMat2DHomMat2DHomMat2DHomMat2DhomMat2D (input_control)  hom_mat2d HHomMat2D, HTupleHTupleHTupleHHomMat2DX, VARIANTHtuple (real) (double) (double) (double) (double) (double)

Homogeneous projective transformation matrix.

InterpolationInterpolationInterpolationInterpolationInterpolationinterpolation (input_control)  string HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Interpolation method for the transformation.

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

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

AdaptImageSizeAdaptImageSizeAdaptImageSizeAdaptImageSizeAdaptImageSizeadaptImageSize (input_control)  string HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Adapt the size of the output image automatically?

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

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

TransformDomainTransformDomainTransformDomainTransformDomainTransformDomaintransformDomain (input_control)  string HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Should the domain of the input image also be transformed?

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

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

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

Possible Predecessors

vector_to_proj_hom_mat2dvector_to_proj_hom_mat2dVectorToProjHomMat2dvector_to_proj_hom_mat2dVectorToProjHomMat2dVectorToProjHomMat2d, hom_vector_to_proj_hom_mat2dhom_vector_to_proj_hom_mat2dHomVectorToProjHomMat2dhom_vector_to_proj_hom_mat2dHomVectorToProjHomMat2dHomVectorToProjHomMat2d, proj_match_points_ransacproj_match_points_ransacProjMatchPointsRansacproj_match_points_ransacProjMatchPointsRansacProjMatchPointsRansac, proj_match_points_ransac_guidedproj_match_points_ransac_guidedProjMatchPointsRansacGuidedproj_match_points_ransac_guidedProjMatchPointsRansacGuidedProjMatchPointsRansacGuided, hom_mat3d_projecthom_mat3d_projectHomMat3dProjecthom_mat3d_projectHomMat3dProjectHomMat3dProject

See also

projective_trans_image_sizeprojective_trans_image_sizeProjectiveTransImageSizeprojective_trans_image_sizeProjectiveTransImageSizeProjectiveTransImageSize, projective_trans_contour_xldprojective_trans_contour_xldProjectiveTransContourXldprojective_trans_contour_xldProjectiveTransContourXldProjectiveTransContourXld, projective_trans_regionprojective_trans_regionProjectiveTransRegionprojective_trans_regionProjectiveTransRegionProjectiveTransRegion, projective_trans_point_2dprojective_trans_point_2dProjectiveTransPoint2dprojective_trans_point_2dProjectiveTransPoint2dProjectiveTransPoint2d, projective_trans_pixelprojective_trans_pixelProjectiveTransPixelprojective_trans_pixelProjectiveTransPixelProjectiveTransPixel

Module

Foundation


ClassesClassesClassesClasses | | | | Operators