I have read a lot of questions on SO about Gaussian blur and FFT, but there aren't answer how to implement steps of it (but there are comments like "it's your homework"). I want to know, how to properly pad the kernel and use FFT and IFFT on kernel and image. Can you provide some pseudocode or implementation in any language like Java, Python, etc. how to do this, or at least some good tutorial how to understand it:
1. FFT the image
2. FFT the kernel, padded to the size of the image
3. multiply the two in the frequency domain (equivalent to convolution in the spatial domain)
4. IFFT (inverse FFT) the result
Steps copied from Gaussian blur and FFT
imread
with a local image which we don't have access to. (2) Don't simply use the red channel to convert to grayscale. Usergb2gray
to do that for you. (3) If you have time, extend to colour images where you would perform the filtering separately per channel. (4) Setting all zero values to a minimum value withfind
is a bit inefficient. Use logical indexing instead:fftkernel(fftkernel == 0) = 1e-6;
You don't needfind
here. – Polite