ImageEn, unit IEVision

IEVisionMatrixToMatrix

IEVisionMatrixToMatrix

Declaration

function IEVisionMatrixToMatrix(IEVisionMatrix: TIEVisionMatrix): TIEMatrix;

Description

Converts a 2x3 (affine) or 3x3 TIEVisionMatrix to a simple TIEMatrix record, e.g. to get the translation, scale and rotation of a matrix returned by getAffineTransform or findHomography.
The matrix can contain 32 or 64 bit floating point values.

IEVision (OpenCV) matrices transform points as columns, while TIEMatrix transforms points as rows, so the values are transposed:
a = m[0, 0]   b = m[1, 0]
c = m[0, 1]   d = m[1, 1]
e = m[0, 2]   f = m[1, 2]

A 3x3 matrix is first divided by m[2, 2]. Its perspective values (m[2, 0] and m[2, 1]) cannot be represented by a TIEMatrix and are ignored, so the result of findHomography is only exact when the homography has no perspective (i.e. it is affine).

Raises an exception if the matrix is not 2x3 or 3x3, or not floating point.

Example

// Get the rotation and translation that aligns two sets of points
M := IEVisionLib().createMath().getAffineTransform( srcPoints, dstPoints );
GetMatrixTransformations( IEVisionMatrixToMatrix( M ), tx, ty, sx, sy, angle );

See Also

◼MatrixToIEVisionMatrix
◼findHomography
◼getAffineTransform