CreateMapCameraUndistort

Creates look-up tables of coordinates of corrected image.

Syntax

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);

Parameters

pxMap
Pointer to the destination x coordinate look-up buffer.
xStep
Distance in bytes between starts of consecutive lines in the pxMap image.
pyMap
Pointer to the destination y coordinate look-up buffer.
yStep
Distance in bytes between starts of consecutive lines in the pyMap image.
roiSize
Size of source and destination images ROI in pixels.
fx
Focal lengths along the x axis.
fy
Focal lengths along the y axis.
cx
x-coordinate of the principal point.
cy
y-coordinate of the principal point.
k1
First coefficient of radial distortion.
k2
Second coefficient of radial distortion.
p1
First coefficient of tangential distortion.
p2
Second coefficient of tangential distortion.
pBuffer
Pointer to the external buffer.

Description

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.

Correction of Set of Distorted Images

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);

Return Values

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.

Submit feedback on this help topic

Copyright © 2000 - 2011, Intel Corporation. All rights reserved.