This is not a programming issue. But I am sure that this is something that is widely known and understood in this community.
I have an image, x and a much smaller image, y, and I need to convolve them by multiplying their FFT. But since they are not the same size, I do not know how to perform multiplication in the frequency domain.
I take the (two-dimensional) FFT x (which is an integer matrix of dimensions 4096 x 4096), which gives me a representation of the frequency domain X (which is a matrix of complex numbers, and I think its dimension is 2048 x 2048).
Similarly, I take (a two-dimensional FFT y (which is an integer matrix of dimension 64 x 64), which gives me a representation of the frequency domain Y (which is also a matrix of complex numbers, and I think this size is 32 x 32).
I use the fourn function in Numerical Recipes, so my input matrices x and y must be collapsed into one-dimensional arrays, which are replaced by their discrete Fourier transforms X and Y. The fact is that although this is a two-dimensional image problem, I work with one-dimensional arrays.
If I were trying to drill two images of the same size, x and y. Everything would be very simple:
X = FFT(x) Y = FFT(y) Z = X * Y (term by term multiplication) Convolution of x and y = IFFT(Z)
But if X and Y are different lengths, how do I do the multiplication?
One possibility is to skip y in order to have the same dimensions as x. But that seems terribly ineffective. Another possibility is to align Y to have the same dimensions as X. But I don't know what that means in frequency space.
Here's another way to ask this question: if I want to drill two images of very different measurements using FFT so that I can multiply their spectra (represent the frequency domain), how do I multiply this?
Thanks,
~ Michael.
image-processing fft signal-processing convolution
Mcm
source share