(Not really a) Problem with nppiFilterRow function with kernel that has negative values

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);

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: https://imgur.com/2aLb4eP
Filtered image with negative kernel values: https://imgur.com/8uDjYLZ
Filtered image without negative kernel values replaced with 0.0f: https://imgur.com/1rECxL0

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?

because the negative values in the kernel mean you can have negative values in your output image.

The question then becomes what pixel characteristics to assign to a negative valued pixel. Apparently it is bright white.

OMG…it seems perfectly obvious when someone “says it out loud”. And, of course, I was clipping negative values to zero in the kernel that I was comparing to.

Thank you.