Creates look-up tables of coordinates of corrected image.
IppStatus ippiCreateMapCameraUndistort_32f_C1R(Ipp32f* pxMap, int xStep, Ipp32f* pyMap, int yStep, IppiSize roiSize, Ipp32f fx, Ipp32f fy, Ipp32f cx, Ipp32f cy, Ipp32f k1, Ipp32f k2, Ipp32f p1, Ipp32f p2, Ipp8u* pBuffer);
The function ippiCreateMapCameraUndistort is declared in the ippcv.h file. It operates with ROI (see Regions of Interest in Intel IPP ).
This function creates the look-up tables of x- and y-coordinates pxMap and pyMap respectively. These coordinates are computed in accordance with camera parameters fx, fy, cx, cy, and distortion parameters k1, k2, p1, p2. The created tables can be used by the Intel IPP function ippiRemap to remap the distorted source image and get the corrected image.
To accelerate the computations the function can pass the pointer to the external buffer pBuffer whose size should be computed previously using the function ippiUndistortGetSize. If a null pointer is passed, slower computations without an external buffer will be performed.
The following Example "Correction of Set of Distorted Images" demonstrates how to correct camera lens distortion for set of images using Intel IPP functions.
Ipp32f *pxMap, *pyMap, *pBuffer;
Int xStep, yStep, buflen;
IppiSize roiSize;
IppiRect rect;
ippiUndistortGetSize (roiSize, &buflen);
buffer = ippiMalloc_8u(buflen);
xMap = ippiMalloc_32f(roiSize.x, roiSize,y, *xStep);
yMap = ippiMalloc_32f(roiSize.x, roiSize,y, *yStep);
ippiCreateMapCameraUndistort_32f_C1R (pxMap, pxStep, yMap, yStep, roiSize, fx, fy, cx, cy, k1, k2, 0, 0, pBuffer);
rect.x = 0; rect.y = 0;
rect.width = roiSize.width; rect.height = roiSize.height;
...
ippiRemap_32f(pSrc, roiSize, srcStep, rect, pxMap, xStep, pyMap, yStep,
pDst, dstStep, roiSize, IPPI_INTER_LINEAR);
...
ippiFree(yMap);
ippiFree(xMap);
ippsFree(buffer);
ippStsNoErr |
Indicates no error. |
ippStsNullPtrErr |
Indicates an error if pxMap or pyMap is NULL. |
ippStsSizeErr |
Indicates an error condition if roiSize has a field with zero or negative value. |
ippStsStepErr |
Indicates an error condition if : xStep is less than roiSize.width * <pixelSize> , or yStep is less than roiSize.width * <pixelSize>. |
ippStsNotEvenStepErr |
Indicates an error condition if one of the step values is not divisible by 4 for floating-point images. |
ippStsBadArgErr |
Indicates an error when fx or fy is equal to 0. |
Copyright © 2000 - 2011, Intel Corporation. All rights reserved.