Foundation (CVFoundation.dll) 14.0
Geometrical Image Transformation Functions

Functions

cvbres_t AreaSubImage (IMG ImgIn, TArea Area, TInterpolationMode Interpolation, IMG &ImgOut)
Create a new image based on an area in an existing image. More...

cvbres_t CalcPerspectiveTransformation (long dstLeft, long dstTop, long dstRight, long dstBottom, double srcX0, double srcY0, double srcX1, double srcY1, double srcX2, double srcY2, double srcX3, double srcY3, double &C00, double &C01, double &C02, double &C10, double &C11, double &C12, double &C20, double &C21, double &C22)
Computes the coefficients C00 to C22 to be used by the function PerspectiveTransformImage. More...

cvbres_t CalcPerspectiveTransformationEx (double dstLeft, double dstTop, double dstRight, double dstBottom, double srcX0, double srcY0, double srcX1, double srcY1, double srcX2, double srcY2, double srcX3, double srcY3, double &C00, double &C01, double &C02, double &C10, double &C11, double &C12, double &C20, double &C21, double &C22)
Computes the coefficients C00 to C22 to be used by the function PerspectiveTransformImage. More...

cvbres_t MatrixTransformImage (IMG ImgIn, TMatrix Matrix, TInterpolationMode Interpolation, IMG &ImgOut)
Applies a transformation matrix to the input image. More...

cvbres_t MirrorImage (IMG ImgIn, cvbbool_t MirrorX, cvbbool_t MirrorY, IMG &ImgOut)
Create a mirrored version (vertically, horizontally or in both directions) of the input image. More...

cvbres_t PerspectiveTransformImage (IMG ImgIn, long DstWidth, long DstHeight, long DstXOffset, long DstYOffset, double C00, double C01, double C02, double C10, double C11, double C12, double C20, double C21, double C22, TInterpolationMode Interpolation, IMG &ImgOut)
Performs perspective transformation of the source image using the give transformation coefficients. More...

cvbres_t ResizeImage (IMG ImgIn, long TargetWidth, long TargetHeight, TInterpolationMode Interpolation, IMG &ImgOut)
Resizes an input image to match a given input width and height. More...

cvbres_t RotateImage (IMG ImgIn, double Angle, TInterpolationMode Interpolation, IMG &ImgOut)
Rotates an image by a given angle. More...

cvbres_t ShearImage (IMG ImgIn, double ShearX, double ShearY, TInterpolationMode Interpolation, IMG &ImgOut)
Shears an image in X and Y direction. More...

◆ AreaSubImage()

 cvbres_t AreaSubImage ( IMG ImgIn, TArea Area, TInterpolationMode Interpolation, IMG & ImgOut )

Create a new image based on an area in an existing image.

For the creation of the sub-image, the coordinate of the input image is being used.
This function is similar to the function \a CreateAreaSubImage in the CVCImg.dll, but it differs in that with this function,
the interpolation mode is selectable, and that \a CreateAreaSubImage does not suffer from the restriction that all points of the Area must be inside the image.

Parameters
 [in] ImgIn Handle of input image. [in] Area Area of the source image that will be the newly created sub-image. Attention: All points of the Area must lie within the source image, otherwise an error will be returned. [in] Interpolation Interpolation mode to be used when creating the new sub image. Allowable values are IP_NearestNeighbour, IP_Linear and IP_Cubic. [out] ImgOut Image handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
TInterpolationMode
Examples:
C# (CSharp) - C# Geometrical Transformation Example

◆ CalcPerspectiveTransformation()

 cvbres_t CalcPerspectiveTransformation ( long dstLeft, long dstTop, long dstRight, long dstBottom, double srcX0, double srcY0, double srcX1, double srcY1, double srcX2, double srcY2, double srcX3, double srcY3, double & C00, double & C01, double & C02, double & C10, double & C11, double & C12, double & C20, double & C21, double & C22 )

Computes the coefficients C00 to C22 to be used by the function PerspectiveTransformImage.

The function \ref PerspectiveTransformImage amps a source area of interest from the specified source quadrangle into the specified target rectangle.

Attention
The source quadrangle must be a convex structure (which means, that the connecting line of any two corners of the quadrangle must not lie outside the quadrangle), otherwise this function will return an error.
Parameters
 [in] dstLeft Left side of the destination rectangle. [in] dstTop Top side of the destination rectangle. [in] dstRight Right side of the destination rectangle. [in] dstBottom Bottom side of the destination rectangle. [in] srcX0 Corresponds to the untransformed top-left corner of the source area of interest. [in] srcY0 Corresponds to the untransformed top-left corner of the source area of interest. [in] srcX1 Corresponds to the untransformed top-right corner of the source area of interest. [in] srcY1 Corresponds to the untransformed top-right corner of the source area of interest. [in] srcX2 Corresponds to the untransformed bottom-right corner of the source area of interest. [in] srcY2 Corresponds to the untransformed bottom-right corner of the source area of interest. [in] srcX3 Corresponds to the untransformed bottom-left corner of the source area of interest. [in] srcY3 Corresponds to the untransformed bottom-left corner of the source area of interest. [out] C00 Target perspective transform coefficients used by PerspectiveTransformImage. [out] C01 Target perspective transform coefficients used by PerspectiveTransformImage. [out] C02 Target perspective transform coefficients used by PerspectiveTransformImage. [out] C10 Target perspective transform coefficients used by PerspectiveTransformImage. [out] C11 Target perspective transform coefficients used by PerspectiveTransformImage. [out] C12 Target perspective transform coefficients used by PerspectiveTransformImage. [out] C20 Target perspective transform coefficients used by PerspectiveTransformImage. [out] C21 Target perspective transform coefficients used by PerspectiveTransformImage. [out] C22 Target perspective transform coefficients used by PerspectiveTransformImage.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
PerspectiveTransformImage, Introduction
Examples:
C# (CSharp) - C# Geometrical Transformation Example

◆ CalcPerspectiveTransformationEx()

 cvbres_t CalcPerspectiveTransformationEx ( double dstLeft, double dstTop, double dstRight, double dstBottom, double srcX0, double srcY0, double srcX1, double srcY1, double srcX2, double srcY2, double srcX3, double srcY3, double & C00, double & C01, double & C02, double & C10, double & C11, double & C12, double & C20, double & C21, double & C22 )

Computes the coefficients C00 to C22 to be used by the function PerspectiveTransformImage.

The function \ref PerspectiveTransformImage amps a source area of interest from the specified source quadrangle into the specified target rectangle.

Attention
The source quadrangle must be a convex structure (which means, that the connecting line of any two corners of the quadrangle must not lie outside the quadrangle), otherwise this function will return an error.

This is effectively a complete alias for CalcPerspectiveTransformation.

Parameters
 [in] dstLeft Left side of the destination rectangle. [in] dstTop Top side of the destination rectangle. [in] dstRight Right side of the destination rectangle. [in] dstBottom Bottom side of the destination rectangle. [in] srcX0 Corresponds to the untransformed top-left corner of the source area of interest. [in] srcY0 Corresponds to the untransformed top-left corner of the source area of interest. [in] srcX1 Corresponds to the untransformed top-right corner of the source area of interest. [in] srcY1 Corresponds to the untransformed top-right corner of the source area of interest. [in] srcX2 Corresponds to the untransformed bottom-right corner of the source area of interest. [in] srcY2 Corresponds to the untransformed bottom-right corner of the source area of interest. [in] srcX3 Corresponds to the untransformed bottom-left corner of the source area of interest. [in] srcY3 Corresponds to the untransformed bottom-left corner of the source area of interest. [out] C00 Target perspective transform coefficients used by PerspectiveTransformImage. [out] C01 Target perspective transform coefficients used by PerspectiveTransformImage. [out] C02 Target perspective transform coefficients used by PerspectiveTransformImage. [out] C10 Target perspective transform coefficients used by PerspectiveTransformImage. [out] C11 Target perspective transform coefficients used by PerspectiveTransformImage. [out] C12 Target perspective transform coefficients used by PerspectiveTransformImage. [out] C20 Target perspective transform coefficients used by PerspectiveTransformImage. [out] C21 Target perspective transform coefficients used by PerspectiveTransformImage. [out] C22 Target perspective transform coefficients used by PerspectiveTransformImage.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
PerspectiveTransformImage, Introduction
Examples:
C# (CSharp) - C# Geometrical Transformation Example

◆ MatrixTransformImage()

 cvbres_t MatrixTransformImage ( IMG ImgIn, TMatrix Matrix, TInterpolationMode Interpolation, IMG & ImgOut )

Applies a transformation matrix to the input image.

TMatrix defines a 2x2 transformation matrix, see definition of TMatrix in the Image Manager documentation.
This function is almost identical with the Image Manager function \a CreateMatrixTransformedImage,
save for the fact that the latter does not support a selectable interpolation.

Parameters
 [in] ImgIn Handle of input image. [in] Matrix Transformation matrix to be applied to the input image. [in] Interpolation Interpolation mode to be used. Allowable values are IP_NearestNeighbour, IP_Linear and IP_Cubic. [out] ImgOut Image handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
TInterpolationMode, CreateMatrixTransformedImage and CreateMatrixTransformedImageEx
Examples:
C# (CSharp) - C# Geometrical Transformation Example

◆ MirrorImage()

 cvbres_t MirrorImage ( IMG ImgIn, cvbbool_t MirrorX, cvbbool_t MirrorY, IMG & ImgOut )

Create a mirrored version (vertically, horizontally or in both directions) of the input image.

Attention
Please have also a look at the possibilities the VPAT offers for image transformation. See GetImageVPA function of the Image Manager and read the Proposal for a Common Image Model for further detailed information on all aspects of virtual pixel access.
Parameters
 [in] ImgIn Handle of input image. [in] MirrorX TRUE means mirroring to the X axis, FALSE otherwise. [in] MirrorY TRUE means mirroring to the Y axis, FALSE otherwise. [out] ImgOut Image handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
RotateImage,
GetImageVPA function of the Image library
Examples:
C# (CSharp) - C# Geometrical Transformation Example

◆ PerspectiveTransformImage()

 cvbres_t PerspectiveTransformImage ( IMG ImgIn, long DstWidth, long DstHeight, long DstXOffset, long DstYOffset, double C00, double C01, double C02, double C10, double C11, double C12, double C20, double C21, double C22, TInterpolationMode Interpolation, IMG & ImgOut )

Performs perspective transformation of the source image using the give transformation coefficients.

The coefficients are usually created by the function CalcPerspectiveTransformation first.

Parameters
 [in] ImgIn Handle of input image. [in] DstWidth Width of the transformed image. [in] DstHeight Height of the transformed image. [in] DstXOffset Ignored. [in] DstYOffset Ignored. [in] C00 Perspective transform coefficients. Created by CalcPerspectiveTransformation. [in] C01 Perspective transform coefficients. Created by CalcPerspectiveTransformation. [in] C02 Perspective transform coefficients. Created by CalcPerspectiveTransformation. [in] C10 Perspective transform coefficients. Created by CalcPerspectiveTransformation. [in] C11 Perspective transform coefficients. Created by CalcPerspectiveTransformation. [in] C12 Perspective transform coefficients. Created by CalcPerspectiveTransformation. [in] C20 Perspective transform coefficients. Created by CalcPerspectiveTransformation. [in] C21 Perspective transform coefficients. Created by CalcPerspectiveTransformation. [in] C22 Perspective transform coefficients. Created by CalcPerspectiveTransformation. [in] Interpolation Interpolation mode to be used. Allowable values are IP_NearestNeighbour, IP_Linear and IP_Cubic. [out] ImgOut Handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
TInterpolationMode, Introduction
Examples:
C# (CSharp) - C# Geometrical Transformation Example

◆ ResizeImage()

 cvbres_t ResizeImage ( IMG ImgIn, long TargetWidth, long TargetHeight, TInterpolationMode Interpolation, IMG & ImgOut )

Resizes an input image to match a given input width and height.

Parameters
 [in] ImgIn Handle of input image. [in] TargetWidth Width for the output image. [in] TargetHeight Height for the output image. [in] Interpolation Interpolation mode to be used. Allowable values are IP_NearestNeighbour, IP_Linear and IP_Cubic. [out] ImgOut Image handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
TInterpolationMode, CreateMatrixTransformedImage, CreateMatrixTransformedImageEx, CreateImageMap
Examples:
C# (CSharp) - C# Geometrical Transformation Example

◆ RotateImage()

 cvbres_t RotateImage ( IMG ImgIn, double Angle, TInterpolationMode Interpolation, IMG & ImgOut )

Rotates an image by a given angle.

Attention
For images coming from an image acquisition device supported by Common Vision Blox via a vin-driver there is in a lot of cases another easy and very fast option to rotate images. Please have a look at the device specific CVB User Guide in the INI-file section.
Parameters
 [in] ImgIn Handle of input image. [in] Angle Rotation angle in degrees. [in] Interpolation Interpolation mode to be used. Allowable values are IP_NearestNeighbour, IP_Linear and IP_Cubic. [out] ImgOut Image handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
TInterpolationMode, CreateMatrixTransformedImage and CreateMatrixTransformedImageEx
Examples:
C# (CSharp) - C# Geometrical Transformation Example

◆ ShearImage()

 cvbres_t ShearImage ( IMG ImgIn, double ShearX, double ShearY, TInterpolationMode Interpolation, IMG & ImgOut )

Shears an image in X and Y direction.

Attention
Keep in mind that abs(ShearX) = abs(ShearY) = 1 is not allowed as parameters, because that would project the whole image into a single line.
Parameters
 [in] ImgIn Handle of input image. [in] ShearX Specifies the amount of shearing in X direction. [in] ShearY Specifies the amount of shearing in Y direction [in] Interpolation Interpolation mode to be used. Allowable values are IP_NearestNeighbour, IP_Linear and IP_Cubic. [out] ImgOut Image handle of result image.
Returns
0 : OK
< 0: an error occurred.
Supported platforms:
Win32
Win64
Related Topics:
TInterpolationMode
Examples:
C# (CSharp) - C# Geometrical Transformation Example