I am using the nppiFilterRow_32f_C1R( )function with a kernel defined as:
{0.0f, -0.0229f, -0.0418f, -0.0477f, -0.0344f, 0.0f, 0.0516f, 0.1114f, 0.1670f, 0.2065f, 0.2207f),
0.2065f, 0.1670f, 0.1114f, 0.0516f, 0.0f, -0.0344f, -0.0477f, -0.0418f, -0.0229f, 0.0f}
The size of the kernel is 21 and the radius is 10. The call looks like:
nRet = nppiFilterRow_32f_C1R(md_curFrameP, (448sizeof(float)), md_buf1P, (448sizeof(float)), {448, 448}, md_kernelP, 21, 10);
where
md_kernelP points to the array shown above that has been copied to device memory.
md_curFrameP points to a 448x448 float image in device memory where the values are between 0.0f and 1.0f.
md_buf1P points to 448x448 float image where the result will be written.
The input image is essentially a black frame with a single vertical non-black stripe in the center. When I run the above filter the result is a filtered with white bands on either side. If I replace the negative components with 0.0f, I get just the filtered stripe I expected.
Original image: [url]https://imgur.com/2aLb4eP[/url]
Filtered image with negative kernel values: [url]https://imgur.com/8uDjYLZ[/url]
Filtered image without negative kernel values replaced with 0.0f: [url]https://imgur.com/1rECxL0[/url]
The kernel values used are derived from the following matlab code:
h = sinc([-MATCH_SIZE:MATCH_SIZE] / MATCH_SIZE * 2); % Create Filter Kernel
h = h / sum(h);
where MATCH_SIZE is 10 and h is a 21 element vector.
Why do the negative kernel values cause the white bands?