AffineTransform3DH

Performs an arbitrary affine transformation with an array of 3D vectors in the Homogeneous coordinate space.

Syntax

IppStatus ippmAffineTransform3DH_mva_32f (const Ipp32f* pSrc1, int src1Stride1, int src1Stride2, const Ipp32f* pSrc2, int src2Stride0, int src2Stride2, Ipp32f* pDst, int dstStride0, int dstStride2, int count);

Parameters

pSrc1

Pointer to the source matrix of size 4x4.

src1Stride1

Stride between the rows in the source matrix.

src1Stride2

Stride between the elements in the source matrix.

pSrc2

Pointer to the source array of 3D vectors.

src2Stride0

Stride between the vectors in the source 3D vector array.

src2Stride2

Stride between the elements in the source 3D vector.

pDst

Pointer to the destination array of 3D vectors.

dstStride0

Stride between the 3D vectors in the destination array.

dstStride2

Stride between the elements in the destination 3D vector.

count

The number of 3D vectors in the array.

Description

The function ippmAffineTransform3DH is declared in the ippm.h header file. The function performs an arbitrary affine transformation (possibly, a degenerate projective transformation) with an array of 3D vectors in the Homogeneous coordinate space. The transformation is represented with the 4x4 matrix pointed by pSrc1. Input and output 3D vector arrays are located at the pSrc2 and pDst addresses, respectively. The number of 3D vectors in the array equals count.

During this transformation, three-dimensional Cartesian coordinates are first transformed into a homogeneous coordinate space, in which the affine transformation is then applied to the vectors using matrix-vector multiplication. After that, the inverse transformation from the Homogeneous to the Cartesian coordinate system is performed.

In more detail, the function performs the following matrix-vector operation to each 3D vector in the source vector array:

that is

X' = t11*X + t12*Y + t13 *Z + t14

Y' = t21*X + t22*Y + t23 *Z + t24

Z' = t31*X + t32*Y + t33 *Z + t34

W = t41*X + t42*Y + t43 *Z + t44 ,

and then the following vector transformation:

X' = X'/W

Y' = Y'/W

Z' = Z'/W

where

tij, 0 i < 4, 0 j < 4, are elements of the source 4x4 matrix Src1,

(X, Y, Z) is the source 3D vector Src2,

(X',Y',Z') is the destination 3D vector Dst.

If W is equal to zero, all the 3D coordinates of the destineation vector are set to IPP_MAXABS, that is, the maximum machine number for the given data type (defined in the ippdefs.h header file), and the function returns the ippStsDivByZeroErr status. However the calculations continue for the remaining 3D vectors in the source array.

The following example demonstrates how to use the function ippmAffineTransform3DH_mva_32f. For more information, see also examples in Getting Started.

ippmAffineTransform3DH_mva_32f  

IppStatus  AffineTransform3DH_mva_32f(void) {
    /* Transformation matrix Src1 with width=4, height=4 as default */
    Ipp32f pSrc1[4*4] = { 1, 2, 3, 2,
                          4, 5, 6, 5,
                          7, 8, 9, 6,
                          2, 4, 6, 1 };
 
    /* Standard description for Src1 */
    int src1Stride1 = 4 * sizeof(Ipp32f);
    int src1Stride2 = sizeof(Ipp32f);
 
    /* Src2 data: two 3D vectors with length=3 as default */
    Ipp32f pSrc2[2*3] = { 1, 6, 3,
                          4, 5, 2 };
 
    /* Standard description for Src2 */
    int src2Stride0  = 3*sizeof(Ipp32f);
    int src2Stride2  = sizeof(Ipp32f);
 
 
    /* 
    // Destination is two 3D vectors
    // Standard description for Dst:
    */
    Ipp32f pDst[2*3];
    int dstStride2 = sizeof(Ipp32f);
    int dstStride0 = 3*sizeof(Ipp32f);
 
    int count = 2;
    
    IppStatus status = ippmAffineTransform3DH_mva_32f( 
        (const Ipp32f*)pSrc1, src1Stride1, src1Stride2,
        (const Ipp32f*)pSrc2, src2Stride0, src2Stride2,
        pDst, dstStride0, dstStride2, count);
 
    /*
    // It is required for AffineTransform3DH function to check return status
    // for catching wrong result in case of invalid input data 
    */
    if(status == ippStsOk){
        printf_va_Ipp32f("Two destination 3D vectors:", pDst, 3, 2, status);
    } else {
        printf("Function returns status: %s \n", ippGetStatusString(status));
    }
    return status;
}
 

The program above produces the following output:

Two destination 3D vectors:

0.533333  1.266667  1.955556

0.536585  1.414634  2.243902

Return Values

ippStsOk

Indicates no error.

ippStsNullPtrErr

Indicates an error when at least one input pointer is NULL.

ippStsStrideMatrixErr

Indicates an error when a stride value is not positive or not divisible by the size of the data type.

ippStsCountMatrixErr

Indicates an error when the count value is less or equal to 0.

ippStsDivByZeroErr

Indicates an error when W is equal to 0 for at least one 3D vector.

Submit feedback on this help topic

Copyright © 2000 - 2011, Intel Corporation. All rights reserved.