WarpPerspectiveLinear
Performs warp perspective transformation of an image using the linear interpolation method.
Syntax
IppStatus ippiWarpPerspectiveLinear_<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 |
8u_C3R | 16u_C3R | 16s_C3R | 32f_C3R |
8u_C4R | 16u_C4R | 16s_C4R | 32f_C4R |
Include Files
ippi.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
' = (c
00
*x
+ c
01
*y
+ c
02
)/ (c
20
*x
+ c
21
*y
+ c
22
)y
' = (c
10
*x
+ c
11
*y
+ c
12
)/(c
20
*x
+ c
21
*y
+ c
22
) where
- x' andy' are the pixel coordinates in the transformed image
- care the affine transform coefficients passed to theijcoeffsarray during initialization
The
ippiWarpPerspectiveLinear
function operates with ROI (see Regions of Interest in Intel IPP). The transformed part of the source image is resampled with the linear 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 pDst
must point to the processed destination image ROI.If you initialize the warp specification structure using the
ippiWarpPerspectiveLinearInit
function, you can specify the source image ROI in the following ways:- Set thesrcRoivalue toippRectInfinite, which means that the ROI is not specified. In this case,pSrcmust point to the processed source image. Pixels that are outside the source image boundaries are computed according to the specified border type.
- Set thesrcRoivalue to the part of the processed source image. In this case,pSrcmust point to the processed source image ROI. The operations take place only inside the specified region of interestsrcRoi. It means that the destination image pixels mapped to the outer pixels of the specified source image region are not changed.
If you initialize the warp specification structure using the
ippiWarpQuadLinearInit
function, set the pSrc
value to the processed source image. The operations take place only inside the source quadrangle srcQuad
that is specified in the ippiWarpQuadLinearInit
function.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 toippBorderRepl, the source image outer pixels are replicated from the edge pixels.
- If the border type is equal toippBorderConst, the outer pixels are set to the constant value specified inpBorderValue.
- If the border type is equal toippBorderTransporippBorderInMem, destination image pixels mapped to the outer source image pixels are not changed.
Before using the
ippiWarpPerspectiveLinear
function, you need to initialize the IppiWarpSpec
structure using the ippiWarpPerspectiveLinearInit
function and compute the size of the external buffer pBuffer
using the ippiWarpGetBufferSize
function.To compute the perspective transform parameters, use the
ippiGetPerspectiveQuad
, ippiGetPerspectiveBound
, and ippiGetPerspectiveTransform
functions.For an example on how to use this functionality, refer to the example provided with the
ippiWarpPerspectiveNearest
function description.Return Values
- ippStsNoErr
- Indicates no error.
- ippStsNullPtrErr
- Indicates an error when one of the specified pointers isNULL.
- ippStsNoOperation
- Indicates a warning when width or height of the destination image is equal to zero.
- 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 extended with borders has no intersection with the destination image.