Specifications

Intel
®
Image Processing Library Reference Manual
6-10
6
Example 6-1 Computing 2-dimensional Convolution (continued)
if( NULL == imga ) return 0;
iplSetBorderMode( imga, IPL_BORDER_REFLECT, IPL_SIDE_TOP|
IPL_SIDE_BOTTOM|IPL_SIDE_LEFT|IPL_SIDE_RIGHT, 0);
imgb = iplCreateImageHeader(
1, 0, IPL_DEPTH_8U, "GRAY", "GRAY",
IPL_DATA_ORDER_PIXEL, IPL_ORIGIN_TL,
IPL_ALIGN_DWORD, 4, 4, NULL, NULL,
NULL, NULL);
if( NULL == imgb ) return 0;
iplAllocateImage( imga, 0, 0 );
if( NULL == imga->imageData ) return 0;
// fill image by meaningless
for( i=0; i<16; i++)
((char*)imga->imageData)[i] = (char)(i+1);
iplAllocateImage( imgb, 0, 0 );
if( NULL == imgb->imageData ) return 0;
// create kernel 3x3 with (1,1) cross point
kernel = iplCreateConvKernel( 3, 3, 1, 1, one, 0 );
// convolve imga by kernel and place the result in imgb
iplConvolve2D( imga, imgb, &kernel, 1, IPL_SUM );
// Check if an error occurred
if( iplGetErrStatus() != IPL_StsOk ) return 0;
}
__finally {
iplDeleteConvKernel( kernel );
iplDeallocate( imga, IPL_IMAGE_HEADER | IPL_IMAGE_DATA );
iplDeallocate( imgb, IPL_IMAGE_HEADER | IPL_IMAGE_DATA );
}
return IPL_StsOk == iplGetErrStatus();
}