Specifications

Intel
®
Image Processing Library Reference Manual
12-4
12
Example 12-1 Computing the Norm of Pixel Values
int example51( void ) {
IplImage *imga, *imgb;
const int width = 4;
const int height = 4;
double norm;
__try {
imga = iplCreateImageHeader(
1, 0, IPL_DEPTH_8U, "GRAY", "GRAY",
IPL_DATA_ORDER_PIXEL, IPL_ORIGIN_TL,
IPL_ALIGN_QWORD, height, width, NULL, NULL,
NULL, NULL);
if( NULL == imga ) return 0;
imgb = iplCreateImageHeader(
1, 0, IPL_DEPTH_8U, "GRAY", "GRAY",
IPL_DATA_ORDER_PIXEL, IPL_ORIGIN_TL,
IPL_ALIGN_QWORD, height, width, NULL, NULL,
NULL, NULL);
if( NULL == imgb ) return 0;
iplAllocateImage( imga, 1, 127 );
if( NULL == imga->imageData ) return 0;
iplAllocateImage( imgb, 1, 1 );
if( NULL == imgb->imageData ) return 0;
norm = iplNorm( imga, imgb, IPL_RELATIVEC );
// Check if an error occurred
if( iplGetErrStatus() != IPL_StsOk ) return 0;
}
__finally {
iplDeallocate(imga,IPL_IMAGE_HEADER|IPL_IMAGE_DATA);
iplDeallocate(imgb,IPL_IMAGE_HEADER|IPL_IMAGE_DATA);
}
return IPL_StsOk == iplGetErrStatus();
}