Image Manager (CVCImg.dll) 14.0
Area and Matrix

Data structures and functions to work with areas of interest and their transformations. More...

Data Structures

struct  TArea
 Describes an area of interest that is using three points (P0, P1 and P2). More...
 
struct  TDRect
 Double precision rectangle defined by its edges. More...
 
struct  TMatrix
 Defines a 2x2 transformation matrix. More...
 

Functions

double Argument (double X, double Y)
 Calculates the argument (direction) of the vector X, Y. More...
 
cvbbool_t CreateAffineTransformedImage (IMG ImageIn, const TCoordinateMap &CS, IMG &ImageOut)
 Creates an affine transformed image from the given ImageIn. More...
 
cvbbool_t CreateAreaAffineTransformedImage (IMG ImageIn, const TCoordinateMap &CS, const TArea &Area, IMG &ImageOut)
 Creates an affine transformed, linear interpolated image of the given Area from the given ImageIn. More...
 
cvbbool_t CreateMatrixTransformedImage (IMG ImageIn, TMatrix Matrix, IMG &ImageOut)
 Creates a matrix transformed image. More...
 
cvbbool_t CreateMatrixTransformedImageEx (IMG ImageIn, TMatrix Matrix, IMG &ImageOut)
 Creates a matrix transformed image. More...
 
bool InverseMatrix (TMatrix A, TMatrix &AInv)
 Computes the inverse of matrix A, if possible. More...
 
double MatrixDeterminant (TMatrix A)
 Calculates the determinant of the given matrix A. More...
 
void MatrixITransform (cvbval_t Xin, cvbval_t Yin, TMatrix A, cvbval_t &Xout, cvbval_t &Yout)
 Calculates the transformation for the input vector (Xin, Yin) based on the matrix A. More...
 
void MatrixRTransform (double Xin, double Yin, TMatrix A, double &Xout, double &Yout)
 Calculates the transformation for the input vector (Xin, Yin) based on the matrix A. More...
 
void MatrixTransformArea (TArea AreaIn, TMatrix A, TArea &AreaOut)
 Performs a matrix transformation on a given area. More...
 
void MultiplyMatrices (TMatrix A, TMatrix B, TMatrix &R)
 Multiplies two matrices A and B. More...
 
void RotationMatrix (double Angle, TMatrix &R)
 Calculates the rotation matrix coefficients for a given Angle. More...
 
void SetArea (double X0, double Y0, double X1, double Y1, double X2, double Y2, TArea &Area)
 Sets the coordinates to the given Area. More...
 
void SetMatrix (double A11, double A12, double A21, double A22, TMatrix &A)
 Sets the components to a 2x2 matrix A. More...
 
void SetRectArea (double Left, double Top, double Right, double Bottom, TArea &Area)
 Sets the Area points P0, P1, and P2 based on the given rectangle borders. More...
 

Detailed Description

Data structures and functions to work with areas of interest and their transformations.

Function Documentation

◆ Argument()

double Argument ( double  X,
double  Y 
)

Calculates the argument (direction) of the vector X, Y.

The angle is calculated clockwise form the positive x-axis.

Calculation
Parameters
[in]XX coordinate of the vector.
[in]YY coordinate of the vector.
Returns
Angle (in degrees) which is spanned between the vector and the positive x-axis.

◆ CreateAffineTransformedImage()

cvbbool_t CreateAffineTransformedImage ( IMG  ImageIn,
const TCoordinateMap CS,
IMG ImageOut 
)

Creates an affine transformed image from the given ImageIn.

The coordinate system is also transformed via ComposeCoordinateMaps to reflect the translatory changes. The resulting ImageOut width and height are as with CreateMatrixTransformedImage, but the image coordinates are also transformed regarding the origin of the given CS. This is where this function differs from CreateMatrixTransformedImage.

This is effectively a shorthand for

TArea area = { 0 };
if(!MaxImageArea(ImageIn))
return false;
return CreateAreaAffineTransformedImage(ImageIn, CS, area, ImageOut);
cvbbool_t CreateAreaAffineTransformedImage(IMG ImageIn, const TCoordinateMap &CS, const TArea &Area, IMG &ImageOut)
Creates an affine transformed, linear interpolated image of the given Area from the given ImageIn.
Definition: TransformationExports.cpp:1413
cvbbool_t MaxImageArea(IMG Image, TArea &Area)
Sets the Area to the full extent of the Image.
Definition: PseudoCOMExports.cpp:249
Describes an area of interest that is using three points (P0, P1 and P2).
Definition: CVTypes.h:170

The following BytesPerPixel for signed and unsigned integer cvbdatatype_t values are supported: 1, 2, 4, and 8. For floating point cvbdatatype_t values only 4 and 8 BytesPerPixel are supported.

Note
Call ReleaseObject on ImageOut, when it is no longer needed.
Parameters
[in]ImageInImage object handle of the source image to be transformed.
[in]CSAffine matrix with which the image is transformed.
[out]ImageOutVariable to receive the handle of the output image.
Returns
true if successful; false otherwise.
See also
CreateMatrixTransformedImage, CreateAreaAffineTransformedImage

◆ CreateAreaAffineTransformedImage()

cvbbool_t CreateAreaAffineTransformedImage ( IMG  ImageIn,
const TCoordinateMap CS,
const TArea Area,
IMG ImageOut 
)

Creates an affine transformed, linear interpolated image of the given Area from the given ImageIn.

The coordinate system is also transformed via ComposeCoordinateMaps to reflect the translatory changes. The resulting ImageOut has the dimensions of the smallest possible rectangle which encloses the given Area which has been transformed with TCoordinateMap::Matrix. The image coordinates are also transformed of ImageOut the given CS.

The following BytesPerPixel for signed and unsigned integer cvbdatatype_t values are supported: 1, 2, 4, and 8. For floating point cvbdatatype_t values only 4 and 8 BytesPerPixel are supported.

Note
Call ReleaseObject on ImageOut, when it is no longer needed.
Parameters
[in]ImageInImage object handle of the source image to be transformed.
[in]AreaArea of interest in image coordinates to be transformed.
[in]CSAffine matrix with which the image is transformed.
[out]ImageOutVariable to receive the handle of the output image.
Returns
true if successful; false otherwise.
See also
CreateMatrixTransformedImage, CreateAffineTransformedImage

◆ CreateMatrixTransformedImage()

cvbbool_t CreateMatrixTransformedImage ( IMG  ImageIn,
TMatrix  Matrix,
IMG ImageOut 
)

Creates a matrix transformed image.

The possible geometric transformations with the specified 2x2 Matrix include

  • rotation
  • scaling
  • stretching.

The resulting ImageOut, which is created via CreateCompatibleImage, has the coordinate system being transformed regarding its origin. The resulting width and height is defined by the bounding box of the matrix transformed image area.

The following BytesPerPixel for signed and unsigned integer cvbdatatype_t values are supported: 1, 2, 4, and 8. For floating point cvbdatatype_t values only 4 and 8 BytesPerPixel are supported.

Note
Call ReleaseObject on ImageOut, when it is no longer needed.
Parameters
[in]ImageInImage object handle of the source image to be transformed.
[in]MatrixMatrix with which the image is transformed.
[out]ImageOutVariable to receive the handle of the output image.
Returns
true if successful; false otherwise.
See also
CreateMatrixTransformedImageEx

◆ CreateMatrixTransformedImageEx()

cvbbool_t CreateMatrixTransformedImageEx ( IMG  ImageIn,
TMatrix  Matrix,
IMG ImageOut 
)

Creates a matrix transformed image.

The possible geometric transformations with the specified 2x2 Matrix include

  • rotation
  • scaling
  • stretching.

The resulting ImageOut, which is created via CreateCompatibleImage, has the default coordinate system. The resulting width and height is defined by the bounding box of the matrix transformed image area.

The following BytesPerPixel for signed and unsigned integer cvbdatatype_t values are supported: 1, 2, 4, and 8. For floating point cvbdatatype_t values only 4 and 8 BytesPerPixel are supported.

Note
Call ReleaseObject on ImageOut, when it is no longer needed.
Parameters
[in]ImageInImage object handle of the source image to be transformed.
[in]MatrixMatrix with which the image is transformed.
[out]ImageOutVariable to receive the handle of the output image.
Returns
true if successful; false otherwise.
See also
CreateMatrixTransformedImage

◆ InverseMatrix()

bool InverseMatrix ( TMatrix  A,
TMatrix AInv 
)
related

Computes the inverse of matrix A, if possible.

Calculation
If the determinant is not zero
Parameters
[in]AInput matrix.
[out]AInvTMatrix object to be filled with the coefficients of the inverted matrix.
Returns
true if inversion succeeded; false otherwise (determinant is zero).
See also
MatrixDeterminant

◆ MatrixDeterminant()

double MatrixDeterminant ( TMatrix  A)
related

Calculates the determinant of the given matrix A.

Calculation
Parameters
[in]AMatrix for which the determinant is calculated.
Returns
Determinant of given matrix A.

◆ MatrixITransform()

void MatrixITransform ( cvbval_t  Xin,
cvbval_t  Yin,
TMatrix  A,
cvbval_t &  Xout,
cvbval_t &  Yout 
)
related

Calculates the transformation for the input vector (Xin, Yin) based on the matrix A.

The transformation is calculated with double precision floating point arithmetic and then rounded (mathematically) to the next integer.

Calculation
Attention
The rounding used in this function is not mathematical for negative values:

double round(double v) { return floor(v + 0.5); }
Parameters
[in]XinX coordinate of input vector.
[in]YinY coordinate of input vector.
[in]AMatrix with which the vector is multiplied.
[out]XoutVariable to be filled with X coordinate of the output vector.
[out]YoutVariable to be filled with Y coordinate of the output vector.
See also
MatrixRTransform

◆ MatrixRTransform()

void MatrixRTransform ( double  Xin,
double  Yin,
TMatrix  A,
double &  Xout,
double &  Yout 
)
related

Calculates the transformation for the input vector (Xin, Yin) based on the matrix A.

Calculation
Parameters
[in]XinX coordinate of input vector.
[in]YinY coordinate of input vector.
[in]AMatrix with which the vector is multiplied.
[out]XoutVariable to be filled with X coordinate of the output vector.
[out]YoutVariable to be filled with Y coordinate of the output vector.
See also
MatrixITransform

◆ MatrixTransformArea()

void MatrixTransformArea ( TArea  AreaIn,
TMatrix  A,
TArea AreaOut 
)
related

Performs a matrix transformation on a given area.

Calculation
Transforms each point of the AreaIn with the given matrix A.

MatrixRTransform(AreaIn.X0, AreaIn.Y0, A, AreaOut.X0, AreaOut.Y0);
MatrixRTransform(AreaIn.X1, AreaIn.Y1, A, AreaOut.X1, AreaOut.Y1);
MatrixRTransform(AreaIn.X2, AreaIn.Y2, A, AreaOut.X2, AreaOut.Y2);
Parameters
[in]AreaInInput area.
[in]ATransformation matrix.
[out]AreaOutArea to receive the transformed point coordinates.

◆ MultiplyMatrices()

void MultiplyMatrices ( TMatrix  A,
TMatrix  B,
TMatrix R 
)
related

Multiplies two matrices A and B.

Calculation
Parameters
[in]AA on the left side of the multiplication.
[in]BA on the right side of the multiplication.
[out]RTMatrix object to be filled with the result of the multiplication.

◆ RotationMatrix()

void RotationMatrix ( double  Angle,
TMatrix R 
)
related

Calculates the rotation matrix coefficients for a given Angle.

Calculation
Parameters
[in]AngleRotation angle (in degrees).
[out]RTMatrix object to be filled with rotation matrix coefficients.

◆ SetArea()

void SetArea ( double  X0,
double  Y0,
double  X1,
double  Y1,
double  X2,
double  Y2,
TArea Area 
)
related

Sets the coordinates to the given Area.

This simply assigns the values to the Area.

Parameters
[in]X0X coordinate of point 0.
[in]Y0Y coordinate of point 0.
[in]X1X coordinate of point 1.
[in]Y1Y coordinate of point 1.
[in]X2X coordinate of point 2.
[in]Y2Y coordinate of point 2.
[out]AreaTArea object to be filled with given coordinates.

◆ SetMatrix()

void SetMatrix ( double  A11,
double  A12,
double  A21,
double  A22,
TMatrix A 
)
related

Sets the components to a 2x2 matrix A.

This simply assigns the values to the matrix A as defined in TMatrix.

Parameters
[in]A11Top left element of matrix.
[in]A12Top right element of matrix.
[in]A21Bottom left element of matrix.
[in]A22Bottom right element of matrix.
[out]ATMatrix object to be filled with given coefficients.

◆ SetRectArea()

void SetRectArea ( double  Left,
double  Top,
double  Right,
double  Bottom,
TArea Area 
)
related

Sets the Area points P0, P1, and P2 based on the given rectangle borders.

P0: (Left, Top)
P1: (Right, Top)
P2: (Left, Bottom)

Parameters
[in]LeftLeft border coordinate of area.
[in]TopTop border coordinate of area.
[in]RightRight border coordinate of area (inclusive).
[in]BottomBottom border coordinate of area (inclusive).
[out]AreaTArea object which points are set based on the given borders.