Intel® Integrated Performance Primitives (Intel® IPP) Developer Guide and Reference

ID 790148
Date 3/22/2024
Public
Document Table of Contents

WarpAffineCubic

Performs warp affine transformation of an image using the cubic interpolation method.

Syntax

IppStatus ippiWarpAffineCubic_<mod>(const Ipp<datatype>* pSrc, int srcStep, Ipp<datatype>* pDst, int dstStep, IppiPoint dstRoiOffset, IppiSize dstRoiSize, const IppiWarpSpec* pSpec, Ipp8u* pBuffer);

Supported values for mod:

8u_C1R

16u_C1R

16s_C1R

32f_C1R

64f_C1R

8u_C3R

16u_C3R

16s_C3R

32f_C3R

64f_C3R

8u_C4R

16u_C4R

16s_C4R

32f_C4R

64f_C4R

Include Files

ippi.h

Flavors with the _L suffix: ippi_l.h

Domain Dependencies

Headers: ippcore.h, ippvm.h, ipps.h

Libraries: ippcore.lib, ippvm.lib, ipps.lib

Parameters

pSrc

Pointer to the source image.

srcStep

Distance, in bytes, between the starting points of consecutive lines in the source image buffer.

pDst

Pointer to the destination image ROI.

dstStep

Distance, in bytes, between the starting points of consecutive lines in the destination image buffer.

dstRoiOffset

Offset of the destination image ROI with respect to the destination image origin.

dstRoiSize

Size of the destination image ROI, in pixels.

pSpec

Pointer to the specification structure for the warp operation.

pBuffer

Pointer to the work buffer.

Description

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

x' = c00*x + c01*y + c02

y' = c10*x + c11*y + c12

where

  • x' and y' are the pixel coordinates in the transformed image

  • cij are the affine transform coefficients passed to the coeffs array during initialization

The affine warping is a general linear transform that incorporates such elementary transformations as scaling, rotation, translation, stretching, and shearing. It always transforms parallel lines into parallel lines and preserves equal distances between points on a line.

The WarpAffineCubic function operates with ROI. The transformed part of the image is resampled with the cubic interpolation method and stored in the destination image ROI. You need to define the destination image ROI origin by the following parameters: the offset of the destination ROI with respect to the destination image origin and the destination image ROI size. The parameter pSrc must point to the source image origin. The parameter pDst must point to the processed destination image ROI.

If you initialize the specification structure using the ippiWarpQuadCubicInit function, the operations take place only inside the specified source quadrangle srcQuad that is set in ippiWarpQuadCubicInit.

To specify the algorithm for borders processing, set the borderType and pBorderValue parameters when initializing the IppiWarpSpec structure. The data type of pBorderValue is automatically converted from Ipp64f to the data type of the processed images. The function supports the following algorithms for borders processing:

  • If the border type is equal to ippBorderRepl, the source image outer pixels are replicated from the edge pixels.

  • If the border type is equal to ippBorderConst, the outer pixels are set to the constant value specified in pBorderValue.

  • If the border type is equal to ippBorderTransp, destination image pixels mapped to the outer source image pixels are not changed. The outer pixels required for cubic interpolation are replicated from the edge pixels.

  • If the border type is equal to ippBorderInMem, destination image pixels mapped to the outer source image pixels are not changed. The outer pixels required for cubic interpolation are obtained from the out of the source image origin space. Cubic interpolation requires additional one-pixel edge from each source image side.

  • The mixed border types can be obtained by the bitwise operation OR between ippBorderTransp and the ippBorderInMemTop, ippBorderInMemBottom, ippBorderInMemLeft, ippBorderInMemRight values

Before using the ippiWarpAffineCubic function, you need to initialize the IppiWarpSpec structure using the ippiWarpAffineCubicInit function and compute the size of the external buffer pBuffer using the WarpGetBufferSize function.

To compute the affine transform parameters, use the GetAffineQuad, GetAffineBound, and GetAffineTransform functions.

For an example on how to use this function, refer to the WarpQuadNearestInit function description.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error when one of the specified pointers is NULL.

ippStsNoOperation

Indicates a warning when width or height of the destination image is equal to zero.

ippStsBorderErr

Indicates an error if border type has an illegal value.

ippStsContextMatchErr

Indicates an error when context data is invalid.

ippStsNotSupportedModeErr

Indicates an error when the requested mode is not supported.

ippStsSizeErr

Indicates an error when width or height of the source or destination image ROI is negative.

ippStsStepErr

Indicates an error when the step value is not a multiple of data type.

ippStsOutOfRangeErr

Indicates an error when the destination image offset point is outside the destination image origin.

ippStsSizeWrn

Indicates a warning when the destination image ROI size is more than the destination image origin size.

ippStsWrongIntersectQuad

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

See Also