Intel® Integrated Performance Primitives
Community support and discussions relating to developing high-performance vision, signal, security, and storage applications.

How should I use the separable filters?

zhpn
Beginner
151 Views
when I use the function ippiFilterRow32f, I made the kernel[] = {1,0,-1}, and I set the parameter kernelSize = 3. But an error ippStsStepErr happens. But the same error does not happen when using the function ippiFilterColumn32f. Thus, I doubt that the kernel array is recognized as a column vector. If so, I have no idea about how to get a row vector.
Furthermore, I do not understand how the result comes about in the example using the function ippiFilterColumn. Why the result should be
0,0,0,0
102,101,101,100
0,0,0,0 ?
It would be very helpful if any one can help me.
Thank you!!
0 Kudos
1 Solution
Ying_H_Intel
Employee
151 Views

Hi
thank you for asking the result 0,0,0,0 102,101,101,100 0,0,0,0 from Example 9-4. It is our manual error. The code should be modified as
Ipp8u src[4*5] = {
1, 2, 3, 4,
1, 2, 3, 4,
1, 2, 3, 4,
1, 2, 3, 4,
1, 2, 3, 4
};
and the result are 0.

Use the function, you may need take care of two things,
1. all IPP filter function assume that each pixel being processed, including the all referred neighborhood pixels necessary for the operation are available. You may read such description in chapter: Filtering function of manual. So either trim the input buffer or add border to input buffer are required.
there isone KB article talking about it, http://software.intel.com/en-us/articles/intel-integrated-performance-primitives-intel-ipp-processin...


2. about the step error, it depends on your array memory layout and data type. Here is a small example

int nRow = 200;
int nCol = 655;
int nCount = nRow * nCol;

Ipp16s *temp = (Ipp16s *)malloc(nCount * sizeof(Ipp16s));
Ipp16s *temp2 = (Ipp16s *)malloc(nCount * sizeof(Ipp16s));

Ipp32s fKernel[] = {1, 2, -3};
int nAnchor = 1; // please notes, ifit is 1 , then itrequired border at upward of image.
int nKernelSize = 3;
int divisor = 2;

IppiSize dstRoiSize2 = {nCol, nRow - 2};

// please note, the step is width*sizeof(Ipp16s)
IppStatus b = ippiFilterColumn_16s_C1R((Ipp16s*)temp + nCol, nCol*sizeof(Ipp16s), (Ipp16s*)temp2 + nCol, nCol*sizeof(Ipp16s), dstRoiSize2, (Ipp32s*)fKernel, nKernelSize, nAnchor,divisor );

printf ("%d: %sn", b, ippGetStatusString(b));
printf ("the step is %dn", nCol*sizeof(Ipp16s));
return 0;
}

Regards,
Ying

View solution in original post

2 Replies
Vladimir_Dudnik
Employee
150 Views

Hello,

you can find an example of how to use separable filters in IPP sample package underfolder image-processing

Regards,
Vladimir
Ying_H_Intel
Employee
152 Views

Hi
thank you for asking the result 0,0,0,0 102,101,101,100 0,0,0,0 from Example 9-4. It is our manual error. The code should be modified as
Ipp8u src[4*5] = {
1, 2, 3, 4,
1, 2, 3, 4,
1, 2, 3, 4,
1, 2, 3, 4,
1, 2, 3, 4
};
and the result are 0.

Use the function, you may need take care of two things,
1. all IPP filter function assume that each pixel being processed, including the all referred neighborhood pixels necessary for the operation are available. You may read such description in chapter: Filtering function of manual. So either trim the input buffer or add border to input buffer are required.
there isone KB article talking about it, http://software.intel.com/en-us/articles/intel-integrated-performance-primitives-intel-ipp-processin...


2. about the step error, it depends on your array memory layout and data type. Here is a small example

int nRow = 200;
int nCol = 655;
int nCount = nRow * nCol;

Ipp16s *temp = (Ipp16s *)malloc(nCount * sizeof(Ipp16s));
Ipp16s *temp2 = (Ipp16s *)malloc(nCount * sizeof(Ipp16s));

Ipp32s fKernel[] = {1, 2, -3};
int nAnchor = 1; // please notes, ifit is 1 , then itrequired border at upward of image.
int nKernelSize = 3;
int divisor = 2;

IppiSize dstRoiSize2 = {nCol, nRow - 2};

// please note, the step is width*sizeof(Ipp16s)
IppStatus b = ippiFilterColumn_16s_C1R((Ipp16s*)temp + nCol, nCol*sizeof(Ipp16s), (Ipp16s*)temp2 + nCol, nCol*sizeof(Ipp16s), dstRoiSize2, (Ipp32s*)fKernel, nKernelSize, nAnchor,divisor );

printf ("%d: %sn", b, ippGetStatusString(b));
printf ("the step is %dn", nCol*sizeof(Ipp16s));
return 0;
}

Regards,
Ying

Reply