Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Applying custom kernel filters

pholden
Beginner
472 Views
I am using version 5.3 and there are a wide range of filters available, but I need to apply a user defined 3x3 filter. Is there any ipp function that can do this?
0 Kudos
3 Replies
Vladimir_Dudnik
Employee
472 Views
Hello,

there is general ippiFilter function which takes a kernel as a parameter, so you may define your own kernels.

Regards,
Vladimir
0 Kudos
pholden
Beginner
472 Views
Hello,

there is general ippiFilter function which takes a kernel as a parameter, so you may define your own kernels.

Regards,
Vladimir

Thanks Vladimir

I think this may do the job by specifying a 3x3 roi sizeand then providing the anchor and divisor to specify particular parts of the kernel matrix. I am new to filters so thanks very much for your help.

Pholden
0 Kudos
Vladimir_Dudnik
Employee
472 Views
According ippiFilter declaration

/* ////////////////////////////////////////////////////////////////////////////
// Names: ippiFilter_8u_C1R
//
// Purpose: Filters an image using a general integer rectangular kernel
// Returns:
// ippStsNoErr OK
// ippStsNullPtrErr One of the pointers is NULL
// ippStsSizeErr dstRoiSize or kernelSize has a field with zero or negative value
// ippStsDivisorErr divisor value is zero, function execution is interrupted
//
// Parameters:
// pSrc Pointer to the source buffer
// srcStep Step in bytes through the source image buffer
// pDst Pointer to the destination buffer
// dstStep Step in bytes through the destination image buffer
// dstRoiSize Size of the source and destination ROI in pixels
// pKernel Pointer to the kernel values ( 32s kernel )
// kernelSize Size of the rectangular kernel in pixels.
// anchor Anchor cell specifying the rectangular kernel alignment
// with respect to the position of the input pixel
// divisor The integer value by which the computed result is divided.
*/

IPPAPI( IppStatus, ippiFilter_8u_C1R, ( const Ipp8u* pSrc, int srcStep,
Ipp8u* pDst, int dstStep, IppiSize dstRoiSize, const Ipp32s* pKernel,
IppiSize kernelSize, IppiPoint anchor, int divisor ))

you need to define 3x3 memory buffer which will be reffered through pKernel pointer then specufy kernelSize (3x3 in your case), fill kernel with desired values and specify kernel anchor point. Note, there is divisor parameter which might be used to normalize filtered results.
Please look at IPP manual for more details.

Regards,
Vladimir
0 Kudos
Reply