Multichannel image convolution #69
-
Hi, I am trying to use vkFFT to do a 2d image ("picture") convolution on an image with multiple channels using the Vulkan backend. I need each channel to be convolved on its own with the same kernel (e.g. a blur kernel). So far I managed to get a convolution on a one-channel image using r2c and the integrated kernel convolution settings to work. The question is now, do I have to decompose my multichannel image into several single channel images or is there a way to specify an element stride in vkFFT? The current memory layout is this:
I would like to avoid separating the channels like this:
But I don't see any other way given the options vkFFT offers. The Also it seems like enabling zero padding disables kernel convolutions. Is this expected? For me it probably would only be useful in combination with an integrated fftshift option (which isn't available, I think?), as my kernels seldomly span the whole image. Thanks for any help and the great library! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hello, For R2C it is not currently possible to do a strided first axis as I have only implemented a non-strided version of R2C optimization so far (it modifies the layout from N real values to N/2+1 complex). I will try and add the strided R2C in one of the future updates. Zero-padding should work with convolutions (see example 51), but in some cases, it may depend on what you are trying to do (for example, convolutions don't work with the Bluestein algorithm on the same axis so far). As for fftshift, no, VkFFT only has the functionality of Fast Fourier Transforms so far. Best regards, |
Beta Was this translation helpful? Give feedback.
-
Many thanks! |
Beta Was this translation helpful? Give feedback.
Hello,
For R2C it is not currently possible to do a strided first axis as I have only implemented a non-strided version of R2C optimization so far (it modifies the layout from N real values to N/2+1 complex). I will try and add the strided R2C in one of the future updates.
Zero-padding should work with convolutions (see example 51), but in some cases, it may depend on what you are trying to do (for example, convolutions don't work with the Bluestein algorithm on the same axis so far). As for fftshift, no, VkFFT only has the functionality of Fast Fourier Transforms so far.
Best regards,
Dmitrii