Specifications

Intel
®
Image Processing Library Reference Manual
11-30
11
Example 11-4 Re-mapping an Image (continued)
/// allocate memory destination with zero data
iplAllocateImage( dst, 1, 0 );
/// provide the x and y coordinates
/// these coords map the image to an identical one
for( y=0; y<height; ++y ) {
float yy = (float)y;
for( x=0; x<width; ++x ) {
float xx = (float)x;
iplPutPixel( xmap, x, y, &xx );
iplPutPixel( ymap, x, y, &yy );
}
}
/// now remap to get the same image
iplRemap( src, xmap, ymap, dst, IPL_INTER_LINEAR );
/// find max abs difference, should be 0
norm = (float)iplNorm( src, dst, IPL_C );
/// deallocate images
iplDeallocate( xmap, IPL_IMAGE_ALL );
iplDeallocate( ymap, IPL_IMAGE_ALL );
iplDeallocate( src, IPL_IMAGE_ALL );
iplDeallocate( dst, IPL_IMAGE_ALL );
return IPL_StsOk == iplGetErrStatus() && norm == 0;
}