Blurring an Image Using
ippiFilterBoxBorder
ippiFilterBoxBorder
A box blur of an image is a filtering process that
sets each pixel in a destination image to the average value of all pixels of a
source image in a rectangular neighborhood of the specified mask size. This
operation has the effect of blurring or smoothing of the source image.
Intel IPP
ippiFilterBoxBorder
function implements box blurring of an
image. Before calling the processing function, you need to allocate memory for
the work buffer. You can get the required memory size for the specified
parameters using the
ippiFilterBoxBorderGetBufferSize
auxiliary function. The
code extract below demonstrates how to use the box blur functionality of Intel
IPP:
…
IppStatus status = ippStsNoErr;
IppiSize maskSize = {3,3};
IppiSize srcSize = {0};
Ipp8u* pBuffer = NULL;
Ipp8u* pSrc = NULL;
Ipp8u* pDst = NULL;
int srcStep, dstStep;
…
/* assigning parameters */
…
/* Get work buffer size */
status = ippiFilterBoxBorderGetBufferSize(srcSize, maskSize, ipp8u, 3, &bufSize);
pBuffer = ippsMalloc_8u(bufSize);
/* Filter the image */
if (status >= ippStsNoErr) status = ippiFilterBoxBorder_8u_C3R(pSrc, srcStep, pDst, dstStep, srcSize, maskSize, ippBorderRepl, NULL, pBuffer);
if (pBuffer) ippsFree(pBuffer);
…
For more information about the
ippiFilterBoxBorder
API and auxiliary functions, refer to
the
Intel IPP Developer Reference
.