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.

## ◆ 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] X X coordinate of the vector. [in] Y Y 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] ImageIn Image object handle of the source image to be transformed. [in] CS Affine matrix with which the image is transformed. [out] ImageOut Variable to receive the handle of the output image.
Returns
true if successful; false otherwise.
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] ImageIn Image object handle of the source image to be transformed. [in] Area Area of interest in image coordinates to be transformed. [in] CS Affine matrix with which the image is transformed. [out] ImageOut Variable to receive the handle of the output image.
Returns
true if successful; false otherwise.
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] ImageIn Image object handle of the source image to be transformed. [in] Matrix Matrix with which the image is transformed. [out] ImageOut Variable to receive the handle of the output image.
Returns
true if successful; false otherwise.
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] ImageIn Image object handle of the source image to be transformed. [in] Matrix Matrix with which the image is transformed. [out] ImageOut Variable to receive the handle of the output image.
Returns
true if successful; false otherwise.
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] A Input matrix. [out] AInv TMatrix object to be filled with the coefficients of the inverted matrix.
Returns
true if inversion succeeded; false otherwise (determinant is zero).
MatrixDeterminant

## ◆ MatrixDeterminant()

 double MatrixDeterminant ( TMatrix A )
related

Calculates the determinant of the given matrix A.

Calculation
Parameters
 [in] A Matrix 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] Xin X coordinate of input vector. [in] Yin Y coordinate of input vector. [in] A Matrix with which the vector is multiplied. [out] Xout Variable to be filled with X coordinate of the output vector. [out] Yout Variable to be filled with Y coordinate of the output vector.
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] Xin X coordinate of input vector. [in] Yin Y coordinate of input vector. [in] A Matrix with which the vector is multiplied. [out] Xout Variable to be filled with X coordinate of the output vector. [out] Yout Variable to be filled with Y coordinate of the output vector.
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] AreaIn Input area. [in] A Transformation matrix. [out] AreaOut Area 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] A A on the left side of the multiplication. [in] B A on the right side of the multiplication. [out] R TMatrix 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] Angle Rotation angle (in degrees). [out] R TMatrix 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] X0 X coordinate of point 0. [in] Y0 Y coordinate of point 0. [in] X1 X coordinate of point 1. [in] Y1 Y coordinate of point 1. [in] X2 X coordinate of point 2. [in] Y2 Y coordinate of point 2. [out] Area TArea 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] A11 Top left element of matrix. [in] A12 Top right element of matrix. [in] A21 Bottom left element of matrix. [in] A22 Bottom right element of matrix. [out] A TMatrix 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] Left Left border coordinate of area. [in] Top Top border coordinate of area. [in] Right Right border coordinate of area (inclusive). [in] Bottom Bottom border coordinate of area (inclusive). [out] Area TArea object which points are set based on the given borders.