Rotating an Image Using Intel IPP Warp Functions

Starting with the 9.0 version, Intel IPP enables you to use the
functions to implement rotation of an image using pre-calculated affine coefficients based on rotation parameters (angle,
-shifts ). To obtain affine coefficients for the specified rotation parameters, you can apply the
function. This function computes the affine coefficients for the transform that rotates an image by the specified angle around (0, 0) and shifts the image by the specified
shift values.
You can apply the computed bounding box to change the
-shifts of the rotated image to fit the transformed image to the destination ROI. To compute the bounding box for the affine transform, use the
Before calling the warp affine processing function, you need to:
  • Compute the size of the specification structure for affine warping with the specified interpolation method using the
  • Initialize the specification structure using the
  • Compute the size of the temporary work buffer required for warping using
    and pass pointer to the buffer to the processing function
The code example below demonstrates how to perform image rotation using the Intel IPP affine warping functions:
IppStatus warpAffine(Ipp8u* pSrc, IppiSize srcSize, int srcStep, Ipp8u* pDst, IppiSize dstSize, int dstStep, const double coeffs[2][3]) { int specSize = 0, initSize = 0, bufSize = 0; Ipp8u* pBuffer = NULL; const Ipp32u numChannels = 3; IppiPoint dstOffset = {0, 0}; IppiBorderType borderType = ippBorderConst; IppiWarpDirection direction = ippWarpForward; Ipp64f pBorderValue[numChannels]; IppiWarpSpec* pSpec = NULL; IppStatus status = ippStsNoErr; for (int i = 0; i < numChannels; ++i) pBorderValue[i] = 255.0; /* Spec and init buffer sizes */ status = ippiWarpAffineGetSize(srcSize, dstSize, ipp8u, coeffs, ippLinear, direction, borderType, &specSize, &initSize); /* Allocate memory */ pSpec = (IppiWarpSpec*)ippsMalloc_8u(specSize); /* Affine transform data initialization */ if (status >= ippStsNoErr) status = ippiWarpAffineLinearInit(srcSize, dstSize, ipp8u, coeffs, direction, numChannels, borderType, pBorderValue, 0, pSpec); /* Get work buffer size */ if (status >= ippStsNoErr) status = ippiWarpGetBufferSize(pSpec, dstSize, &bufSize); pBuffer = ippsMalloc_8u(bufSize); /* Affine transform processing */ if (status >= ippStsNoErr) status = ippiWarpAffineLinear_8u_C3R(pSrc, srcStep, pDst, dstStep, dstOffset, dstSize, pSpec, pBuffer); /* Free memory */ ippsFree(pSpec); ippsFree(pBuffer); return status; }
For more information about the Intel IPP Warp functions, refer to the
Intel IPP Developer Reference

Product and Performance Information


Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804