WarpAffineNearest
Performs warp affine transformation of an image using the nearest neighbor interpolation method.
Syntax
IppStatus ippiWarpAffineNearest_<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
' = c
00
*x
+ c
01
*y
+ c
02
y
' = c
10
*x
+ c
11
*y
+ c
12
where
- x' andy' are the pixel coordinates in the transformed image
- care the affine transform coefficients passed to theijcoeffsarray 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
WarpAffineNearest
function operates with ROI. The transformed part of the image is resampled with the nearest neighbor 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 WarpQuadNearestInit function, the operations take place only inside the specified source quadrangle
srcQuad
that is set in WarpQuadNearestInit.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
WarpAffineNearest
function, you need to initialize the IppiWarpSpec
structure using the WarpAffineNearestInit 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 isNULL.
- 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 destination ROI has no intersection with the transformed source image origin.