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

Ippi's example 9-5: Separable kernel convolution

liorda
Beginner
524 Views
Hi, I can't get example 9-5 in the ippi manual to work. my code is as follow:

Ipp16s img[6*6]= { 0, 0, 0, 0, 0, 0,
0, 1, 0,-1, 0, 0,
0, 0,-1, 0, 2, 0,
0, 1, 0,-2, 1, 0,
0, 1, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0 };

Ipp16s output[4*4];
Ipp16s buf[4*4];
Ipp16s kerx[3] = {1, 1, 1};
Ipp16s kery[3] = {1, 1, 1};
IppiSize roi = {4,4};

ippiCopy_16s_C1R(img+7, 6*sizeof(Ipp16s), buf, 4*sizeof(Ipp16s), roi);
Separable_3x3(buf, 4*sizeof(Ipp16s), output, 4*sizeof(Ipp16s), roi, kerx, kery);


can anyone help?
0 Kudos
4 Replies
Chao_Y_Intel
Moderator
524 Views


Hello,

This looks an image border issue. Image filtering functions assume that for each pixel being processed, adjacent pixels also exist. You may check the following artile for more information on this topic:
http://software.intel.com/en-us/articles/intel-integrated-performance-primitives-intel-ipp-processing-an-image-from-edge-to-edge.



Could you look at if thecode bellow work for u?

Ipp16s img[6*6]= { 0, 0, 0, 0, 0, 0,
0, 1, 0,-1, 0, 0,
0, 0,-1, 0, 2, 0,
0, 1, 0,-2, 1, 0,
0, 1, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0 };

Ipp16s output[4*4];
Ipp16s buf[6*6];
Ipp16s kerx[3] = {1, 1, 1};
Ipp16s kery[3] = {1, 1, 1};
IppiSize roi = {4,4};
IppiSize roi1 = {6,6};

ippiCopy_16s_C1R(img, 6*sizeof(Ipp16s), buf, 6*sizeof(Ipp16s), roi1);
Separable_3x3(buf+7, 6*sizeof(Ipp16s), output, 4*sizeof(Ipp16s), roi, kerx, kery);

Thanks,
Chao

0 Kudos
liorda
Beginner
524 Views
Quoting - Chao Yu (Intel)


Hello,

This looks an image border issue. Image filtering functions assume that for each pixel being processed, adjacent pixels also exist. You may check the following artile for more information on this topic:
http://software.intel.com/en-us/articles/intel-integrated-performance-primitives-intel-ipp-processing-an-image-from-edge-to-edge.



Could you look at if thecode bellow work for u?

Ipp16s img[6*6]= { 0, 0, 0, 0, 0, 0,
0, 1, 0,-1, 0, 0,
0, 0,-1, 0, 2, 0,
0, 1, 0,-2, 1, 0,
0, 1, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0 };

Ipp16s output[4*4];
Ipp16s buf[6*6];
Ipp16s kerx[3] = {1, 1, 1};
Ipp16s kery[3] = {1, 1, 1};
IppiSize roi = {4,4};
IppiSize roi1 = {6,6};

ippiCopy_16s_C1R(img, 6*sizeof(Ipp16s), buf, 6*sizeof(Ipp16s), roi1);
Separable_3x3(buf+7, 6*sizeof(Ipp16s), output, 4*sizeof(Ipp16s), roi, kerx, kery);

Thanks,
Chao


I'm maybe missing something, but I still can't get the code to work as expected. the other convolution methods work normally. the attched example should produce the same output, but the separable method somehow disfunctions...

I'd love to hear what am I doing wrong. my complete test code attached.

Thanks,
--Lior
0 Kudos
liorda
Beginner
524 Views
can anyone please have a look? I followd the manual example and I can't get right results.

Thanks,
--Lior
0 Kudos
Chao_Y_Intel
Moderator
524 Views

Hi Lior,

In the file attached, the Separable_3x3 function is using duplicate border (ippBorderRepl), while other two filter functions are using 0 border.

I modified somecode to make that sample more easily to understand ( attached). The code can produce the same output for three filter functions.

Thanks,
Chao
0 Kudos
Reply