Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Convolution - border handling

teeter
Beginner
524 Views
I'm using VSL to do a 2D image convolution (based on FFT). The documention doesn't seem to discuss how to handle image borders. From the convolution output, it looks like the implementation is padding the borders with zero (black pixels).

Is there a way to change its behavior to repeat the border pixels? Or to mirror the image?

If not, how can I achieve this? Do I have to manually pad my input data? Or does the FFT library in MKL provide a more efficient way for me to do this?

Thanks.

0 Kudos
4 Replies
Vladimir_Petrov__Int
New Contributor III
524 Views
Hello,
MKL convolution routine does not provide special border handling capabilities. To achieve these effects it is necessary to specifically organize input and/or output data.
-Vladimir
0 Kudos
teeter
Beginner
524 Views
Hello Vladimir,

Thanks for your answer. The MKL reference manual does not seem to discuss how to organize my data. Is there a usage example that shows how to do this?

Thanks.
0 Kudos
Vladimir_Petrov__Int
New Contributor III
524 Views
Hello,
Right now there are only 1D examples for convolution in MKL. It is considered to add examplesfor 2D and 3D convolution/correlation toa futurerelease.We could make it closer to your needs if you provide more details.
Best regards,
- Vladimir
0 Kudos
teeter
Beginner
524 Views
Hello Vladimir,

Do these 1D examples show how to handle boundaries? Could you point me to these examples? I only saw examples for scond1() and sconf1(), which weren't helpful to me because I have never used the IBM ESSL library.

For my case, I have an input image (2D) of size HxW pixels. I want to convolve the image with a kernel to produce an output image of the same size. I believe this is a common situation for image convolution. An example showing how to do this with border handling would be nice.

Convolution/correlation can be implemented using FFT. It would be nice to have an example showing how to use MKL's FFT library to implement the same convolution/correlation. There are probably some situations where this is more efficient, e.g. when the kernels can be pre-computed. Again, this is for images (2D) and the boundaries need to be padded by repeating or mirroring pixels.

Thanks.

0 Kudos
Reply