I am trying to understand why 2D FFT is done on a Gaussian process in a particular code. From my understanding from these posts:

  1. https://www.researchgate.net/post/Why_would_we_want_to_do_Fourier_transform_of_a_Gaussian_signal

  2. Why use a gaussian low pass filter, when we can convolve with gaussian kernel

  3. Zero padding effect on a FFT of gaussian noise

It appears that it is used to

  • reduce noise
  • reduce the sharpness on the edges

I am working with MATLAB, and the code snippet is as follows. Please note the peak has been moved to the top-left in the gaussian_shaped_label function, with wrap-around:

%window size, taking padding into account
window_sz = floor(target_sz * (1 + padding));

%   we could choose a size that is a power of two, for better FFT
%   performance. in practice it is slower, due to the larger window size.
%   window_sz = 2 .^ nextpow2(window_sz);

%create regression labels, gaussian shaped, with a bandwidth proportional to target size
output_sigma = sqrt(prod(target_sz)) * output_sigma_factor / cell_size;
yf = fft2(gaussian_shaped_labels(output_sigma, floor(window_sz / cell_size)));

I was trying to plot the two results.

  1. The Gaussian (left) zoomed on the top-left edge(right):

Plotting the code:

gaussian_shaped_labels(output_sigma, floor(window_sz / cell_size)));

enter image description here

  1. The absolute value of the 2D FFT of the Gaussian mentioned in point 1 (left) zoomed on the top-left(right): Plotting the code-
fft2(gaussian_shaped_labels(output_sigma, floor(window_sz / cell_size)));

enter image description here

The plot of 2D FFT seems sharper than the Gaussian. Shouldn't 2D FFT actually blur the edges and make it smoother or something? I think I am going wrong somewhere and any help will be appreciated.

P. S.
If you can help me understand the mathematically too, it would extra helpful but not a hard requirement here.


Why Does 2D FFT of Gaussian Looks More Sharper than Gaussian Itself?

Have a look at the Fourier Transfrom of a Gaussian Signal.

$$ \mathcal{F}_{x} \left\{ {e}^{-a {x}^{2} } \right\} \left( \omega \right) = \sqrt{\frac{\pi}{a}} {e}^{- {\pi}^{2} \frac{ {\omega}^{2} }{a} } $$

First, Gaussian Signal stays Gaussian under Fourier Transform.

As you can see, the parameter which multiplies the variable is inverted.
Let's say $ a = 5 $, then it means that in time we will have very sharp and thin Gaussian while in frequency we will have very smooth and wide Gaussian.

This is related to other property of Forier Transform.
In simple words, what's thin on Time / Spatial Domain is Wide on Frequency Doman and vise versa.
This is basically the Uncertainty Principle of Fourier Transform.

  • $\begingroup$ Thanks. I get the mathematical explanation you gave. I still have a question. From your answer, it implies that 2D FFT should be smoother, shouldn't it? We are looking at the intensity frequency of the image (spatial domain) in the picture. But here we have a sharper image unless expected smoother image. Why? $\endgroup$ – Sulphur Mar 25 at 19:38
  • $\begingroup$ The Uncertainty Principle works for any number of dimensions. It means signal with small effective support in one domain will have large effective support in the other domain. Think about the support, not the values. $\endgroup$ – Royi Mar 25 at 20:54
  • $\begingroup$ Thank you. I did. $\endgroup$ – Sulphur Apr 1 at 19:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.