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

Image filter m-by-n convolution

Deleted_U_Intel
Employee
723 Views
Hello,
Does anyone know which function in IPP produce image filter m-by-n convolution?
Thanks
Chuck
0 Kudos
4 Replies
Vladimir_Dudnik
Employee
723 Views
Hi Chuck,
I recommend you to take a look on IPP manuals. We have several convolution functions in ippIP library (which means 2D images), please find ippiConv*** function family.
Regards,
Vladimir
0 Kudos
seiji-torigoe
Beginner
723 Views
#include "ipp.h"
int main(int argc, char* argv[])
{
Ipp8u Src[5 * 4] = {
{ 1},{ 2},{ 3},{ 4},{ 5},
{ 6},{ 7},{ 8},{ 9},{10},
{11},{12},{13},{14},{15},
{16},{17},{18},{19},{20},
};
Ipp8u Buf[(5+2) * (4+2)] = {
{ 1}, { 1},{ 2},{ 3},{ 4},{ 5}, { 5},
{ 1}, { 1},{ 2},{ 3},{ 4},{ 5}, { 5},
{ 6}, { 6},{ 7},{ 8},{ 9},{10}, {10},
{11}, {11},{12},{13},{14},{15}, {15},
{16}, {16},{17},{18},{19},{20}, {20},
{16}, {16},{17},{18},{19},{20}, {20},
};
int bufStep = 5 + 2;
Ipp8u Dst[5 * 4];
int dstStep = 5;
IppiSize dstRoiSize = {5, 4};
Ipp32f Kernel[3*3] = {
{1.0},{1.0},{1.0},
{1.0},{1.0},{1.0},
{1.0},{1.0},{1.0},
};
IppiSize kernelSize = {3, 3};
IppiPoint anchor = {1, 1};
IppStatus Status;
Status = ippiFilter32f_8u_C1R(Buf+1+bufStep,
bufStep, Dst, dstStep, dstRoiSize,
Kernel, kernelSize, anchor);
int y, x; Ipp8u *pTmp;
for ( y = 0; y < 4; y++ )
{
pTmp = Dst + y * dstStep;
for ( x = 0; x < 5; x++ )
{
printf("%d ", *pTmp); pTmp++;
}
}
return 0;
}

Message Edited by Seiji-Torigoe on 11-18-2004 10:59 PM

0 Kudos
Vladimir_Dudnik
Employee
723 Views
Hi,
There is answer from our expert

Youshould provide 2-pixel border for 5x5 kernel and anchor in the center. For example:

Ipp32f *pImg, *pDst, *pRoi, pK[25]=
{
1.f, 1.f, 1.f, 1.f, 1.f,
1.f, 1.f, 1.f, 1.f, 1.f,
1.f, 1.f, 1.f, 1.f, 1.f,
1.f, 1.f, 1.f, 1.f, 1.f,
1.f, 1.f, 1.f, 1.f, 1.f
};

IppiSize roi;
IppiPoint anch;
IppiSize ker;
int sstep, dstep;

pImg = ippiMalloc_32f_C1( 14, 14, &sstep );
pDst = ippiMalloc_32f_C1( 10, 10, &dstep );

roi.height = roi.width = 14;

ippiSet( 1.f, pImg, sstep, roi );

ker.width = ker.height = 5;
roi.height = roi.width = 10;

anch.x = anch.y = 2;

pRoi = (Ipp32f*)((Ipp8u*)pImg+2*sstep+2*sizeof(Ipp32f));

ippiFilter_32f_C1R( pRoi, sstep, pDst, dstep, roi, pK, ker, anch );

kkkkkxxxxxxxxx
kkkkkxxxxxxxxx
kkAkkrrrrrrrxx
kkkkkrrrrrrrxx
kkkkkrrrrrrrxx
xxrrrrrrrrrrxx
xxrrrrrrrrrrxx
xxrrrrrrrrrrxx
xxrrrrrrrrrrxx
xxrrrrrrrrrrxx
xxrrrrrrrrrrxx
xxrrrrrrrrrrxx
xxxxxxxxxxxxxx
xxxxxxxxxxxxxx

There is how to obtain 1-st point - A (anchor) points to the 1-st point of the roi.

Regards,
Vladimir

0 Kudos
Intel_C_Intel
Employee
723 Views
Why do you need to do: (Ipp8u*) pImg below?
pRoi = (Ipp32f*)((Ipp8u*)pImg+2*sstep+2*sizeof(Ipp32f));
Is the following sentence correct?
pRoi = (Ipp32f*)(pImg+2*sstep+2*sizeof(Ipp32f));
0 Kudos
Reply