WarpPerspective

Performs perspective warping of the source image using the given transform coefficients.

Syntax

Case 1: Operation on pixel-order data

IppStatus ippiWarpPerspective_<mod>(const Ipp<datatype>* pSrc, IppiSize srcSize, int srcStep, IppiRect srcRoi, Ipp<datatype>* pDst, int dstStep, IppiRect dstRoi, const double coeffs[3][3], int interpolation);

Supported values for mod:

8u_C1R

16u_C1R

32f_C1R

8u_C3R

16u_C3R

32f_C3R

8u_C4R

16u_C4R

32f_C4R

8u_AC4R

16u_AC4R

32f_AC4R

Case 2: Operation on planar-order data

IppStatus ippiWarpPerspective_<mod>(const Ipp<datatype>* const pSrc[3], IppiSize srcSize, int srcStep, IppiRect srcRoi, Ipp<datatype>* const pDst[3], int dstStep, IppiRect dstRoi, const double coeffs[3][3], int interpolation);

Supported values for mod:

8u_P3R

16u_P3R

32f_P3R

IppStatus ippiWarpPerspective_<mod>(const Ipp<datatype>* const pSrc[4], IppiSize srcSize, int srcStep, IppiRect srcRoi, Ipp<datatype>* const pDst[4], int dstStep, IppiRect dstRoi, const double coeffs[3][3], int interpolation);

Supported values for mod:

8u_P4R

16u_P4R

32f_P4R

Parameters

pSrc

Pointer to the source image origin.An array of separate pointers to each plane in case of data in planar format.

srcSize

Size in pixels of the source image.

srcStep

Distance in bytes between starts of consecutive lines in the source image buffer.

srcRoi

Region of interest in the source image (of the IppiRect type).

pDst

Pointer to the destination image origin. An array of separate pointers to each plane in case of data in planar format.

dstStep

Distance in bytes between starts of consecutive lines in the destination image buffer.

dstRoi

Region of interest in the destination image (of the IppiRect type).

coeffs

The perspective transform coefficients.

interpolation

Specifies the interpolation mode. Use one of the following values:

IPPI_INTER_NN

nearest neighbor interpolation

IPPI_INTER_LINEAR

linear interpolation

IPPI_INTER_CUBIC

cubic interpolation

IPPI_SMOOTH_EDGE

use edge smoothing in addition to one of the above modes.

Description

The function ippiWarpPerspective is declared in the ippi.h file. It operates with ROI (see ROI Processing in Geometric Transforms).

This perspective warp function transforms the source image pixel coordinates (x,y) according to the following formulas:

x' = (c00* x + c01* y + c02)/ (c20* x + c21* y + c22)

y' = (c10* x + c11* y + c12)/ (c20* x + c21* y + c22)

where x' and y' denote the pixel coordinates in the transformed image, and cij are the perspective transform coefficients passed in the array coeffs.

The transformed part of the image is resampled using the interpolation mode specified by the interpolation parameter, and written to the destination image ROI.

Note iconNote

IPPI_SMOOTH_EDGE is the artificial method. It is not universal: in some cases it can improve the image, but in some other cases it is not effective. For example, the smoothing does not improve the images with the high contrast borders. In such cases don't use edge smoothing.

Figure “Perspective Transform of an Image” gives an example of applying the perspective transform function ippiWarpPerspective to a sample image.

Perspective Transform of an Image

To estimate how the source image ROI will be transformed by the ippiWarpPerspective function, use functions ippiWarpPerspectiveQuad and ippiGetPerspectiveBound. To calculate coefficients of the perspective transform that maps source ROI to a given quadrangle, use ippiGetPerspectiveTransform function.

Example “Using Intel IPP Functions for Perspective Warping” shows how to use the function ippiWarpPerspective_32f_C1R.

Return Values

ippStsNoErr

Indicates no error. Any other value indicates an error or a warning.

ippStsNullPtrErr

Indicates an error condition if one of the specified pointer is NULL.

ippStsSizeErr

Indicates an error condition if any image dimension has zero or negative value.

ippStsStepErr

Indicates an error condition if srcStep or dstStep has a zero or negative value.

ippStsRectErr

Indicates an error condition if width or height of the intersection of the srcRoi and source image is less than or equal to 1.

ippStsInterpolationErr

Indicates an error condition if interpolation has an illegal value.

ippStsCoeffErr

Indicates an error condition if coefficient values are invalid.

ippStsWrongIntersectROIErr

Indicates an error condition if srcRoi has no intersection with the source image.

ippStsWrongIntersectQuad

Indicates a warning that no operation is performed if the transformed source ROI has no intersection with the destination ROI.

Submit feedback on this help topic

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