Foundation (CVFoundation.dll) 15.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...
 

Detailed Description

Function Documentation

◆ 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]ImgInHandle of input image.
[in]AreaArea 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]InterpolationInterpolation mode to be used when creating the new sub image.
Allowable values are IP_NearestNeighbour, IP_Linear and IP_Cubic.
[out]ImgOutImage 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]dstLeftLeft side of the destination rectangle.
[in]dstTopTop side of the destination rectangle.
[in]dstRightRight side of the destination rectangle.
[in]dstBottomBottom side of the destination rectangle.
[in]srcX0Corresponds to the untransformed top-left corner of the source area of interest.
[in]srcY0Corresponds to the untransformed top-left corner of the source area of interest.
[in]srcX1Corresponds to the untransformed top-right corner of the source area of interest.
[in]srcY1Corresponds to the untransformed top-right corner of the source area of interest.
[in]srcX2Corresponds to the untransformed bottom-right corner of the source area of interest.
[in]srcY2Corresponds to the untransformed bottom-right corner of the source area of interest.
[in]srcX3Corresponds to the untransformed bottom-left corner of the source area of interest.
[in]srcY3Corresponds to the untransformed bottom-left corner of the source area of interest.
[out]C00Target perspective transform coefficients used by PerspectiveTransformImage.
[out]C01Target perspective transform coefficients used by PerspectiveTransformImage.
[out]C02Target perspective transform coefficients used by PerspectiveTransformImage.
[out]C10Target perspective transform coefficients used by PerspectiveTransformImage.
[out]C11Target perspective transform coefficients used by PerspectiveTransformImage.
[out]C12Target perspective transform coefficients used by PerspectiveTransformImage.
[out]C20Target perspective transform coefficients used by PerspectiveTransformImage.
[out]C21Target perspective transform coefficients used by PerspectiveTransformImage.
[out]C22Target 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]dstLeftLeft side of the destination rectangle.
[in]dstTopTop side of the destination rectangle.
[in]dstRightRight side of the destination rectangle.
[in]dstBottomBottom side of the destination rectangle.
[in]srcX0Corresponds to the untransformed top-left corner of the source area of interest.
[in]srcY0Corresponds to the untransformed top-left corner of the source area of interest.
[in]srcX1Corresponds to the untransformed top-right corner of the source area of interest.
[in]srcY1Corresponds to the untransformed top-right corner of the source area of interest.
[in]srcX2Corresponds to the untransformed bottom-right corner of the source area of interest.
[in]srcY2Corresponds to the untransformed bottom-right corner of the source area of interest.
[in]srcX3Corresponds to the untransformed bottom-left corner of the source area of interest.
[in]srcY3Corresponds to the untransformed bottom-left corner of the source area of interest.
[out]C00Target perspective transform coefficients used by PerspectiveTransformImage.
[out]C01Target perspective transform coefficients used by PerspectiveTransformImage.
[out]C02Target perspective transform coefficients used by PerspectiveTransformImage.
[out]C10Target perspective transform coefficients used by PerspectiveTransformImage.
[out]C11Target perspective transform coefficients used by PerspectiveTransformImage.
[out]C12Target perspective transform coefficients used by PerspectiveTransformImage.
[out]C20Target perspective transform coefficients used by PerspectiveTransformImage.
[out]C21Target perspective transform coefficients used by PerspectiveTransformImage.
[out]C22Target 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]ImgInHandle of input image.
[in]MatrixTransformation matrix to be applied to the input image.
[in]InterpolationInterpolation mode to be used.
Allowable values are IP_NearestNeighbour, IP_Linear and IP_Cubic.
[out]ImgOutImage 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]ImgInHandle of input image.
[in]MirrorXTRUE means mirroring to the X axis, FALSE otherwise.
[in]MirrorYTRUE means mirroring to the Y axis, FALSE otherwise.
[out]ImgOutImage 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]ImgInHandle of input image.
[in]DstWidthWidth of the transformed image.
[in]DstHeightHeight of the transformed image.
[in]DstXOffsetIgnored.
[in]DstYOffsetIgnored.
[in]C00Perspective transform coefficients. Created by CalcPerspectiveTransformation.
[in]C01Perspective transform coefficients. Created by CalcPerspectiveTransformation.
[in]C02Perspective transform coefficients. Created by CalcPerspectiveTransformation.
[in]C10Perspective transform coefficients. Created by CalcPerspectiveTransformation.
[in]C11Perspective transform coefficients. Created by CalcPerspectiveTransformation.
[in]C12Perspective transform coefficients. Created by CalcPerspectiveTransformation.
[in]C20Perspective transform coefficients. Created by CalcPerspectiveTransformation.
[in]C21Perspective transform coefficients. Created by CalcPerspectiveTransformation.
[in]C22Perspective transform coefficients. Created by CalcPerspectiveTransformation.
[in]InterpolationInterpolation mode to be used.
Allowable values are IP_NearestNeighbour, IP_Linear and IP_Cubic.
[out]ImgOutHandle 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]ImgInHandle of input image.
[in]TargetWidthWidth for the output image.
[in]TargetHeightHeight for the output image.
[in]InterpolationInterpolation mode to be used.
Allowable values are IP_NearestNeighbour, IP_Linear and IP_Cubic.
[out]ImgOutImage 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]ImgInHandle of input image.
[in]AngleRotation angle in degrees.
[in]InterpolationInterpolation mode to be used.
Allowable values are IP_NearestNeighbour, IP_Linear and IP_Cubic.
[out]ImgOutImage 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]ImgInHandle of input image.
[in]ShearXSpecifies the amount of shearing in X direction.
[in]ShearYSpecifies the amount of shearing in Y direction
[in]InterpolationInterpolation mode to be used.
Allowable values are IP_NearestNeighbour, IP_Linear and IP_Cubic.
[out]ImgOutImage 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