Question: I'm trying generate the FFT of a Gaussian kernel to use in later filtering. My understanding is that the FFT of a Gaussian kernel should yield a magnitude that is visually similar to the original intensity image. Here's what I'm getting,

![Intensity and resultant fft](https://i.stack.imgur.com/BGrld.png)

Here's a snippet that should reproduce this image.

```
import numpy as np
import cv2
from matplotlib import pyplot as plt

ksize       = 50
ksize       = ksize*2+1
sigma       = 15
fil         = cv2.getGaussianKernel(ksize,0)
fil         = fil * fil.T

fil_fft = cv2.dft(np.float32(fil),flags = cv2.DFT_COMPLEX_OUTPUT)
fil_shift = np.fft.fftshift(fil_fft)

magnitude_fil = 20*np.log(cv2.magnitude(fil_shift[:,:,0],fil_shift[:,:,1]))

plt.subplot(131),plt.imshow(fil)
plt.title('Input Image'), plt.xticks([]), plt.yticks([])
plt.subplot(132),plt.imshow(magnitude_fil)
plt.title('FFT (Magnitude)'), plt.xticks([]), plt.yticks([])
plt.show()

```

Any ideas as to why I'm getting this t-shaped response would be great.

Answer: 
You are correctly computing the Fourier transform of your Gaussian, and get a Gaussian back. But you display the logarithm of the magnitude. This logarithmic transformation makes the Gaussian look like a parabola, and enhances the very low-intensity noise (from numerical precision issues) in the result.

The large cross across the output is due to aliasing: there is very little aliasing in this figure, but the Gaussian is infinitely large, and so will always be cut off, even if the part that is missing is very, very low intensity -- the logarithmic stretching just brings it right out.

If I repeat your experiment and show the FFT without (left) and with logarithmic stretching (right) you'll see the difference:

[![enter image description here](https://i.stack.imgur.com/myUjL.png)](https://i.stack.imgur.com/myUjL.png)

I use different software, so my figure on the right looks different from yours, it has less noise.

Note that the Fourier transform of a Gaussian is a Gaussian, but the sizes will differ, as [explained by Mick in his answer](https://stackoverflow.com/a/52439154/7328782).
What you are getting as the "t" shape is the Gaussian kernel in the Fourier domain. As the kernel is wider in the spatial domain it is smaller in the Fourier domain, sort of "compressed" along the axes because instead of showing the changing colours across the *x* and *y* axes, the Fourier transform is showing the *rate of change* of the colours, i.e. colour gradients.

The Fourier transform of a (1-D) Gaussian kernel is:  

[![enter image description here](https://i.stack.imgur.com/z0WZi.gif)](https://i.stack.imgur.com/z0WZi.gif)

The Fourier transform of the Gaussian function is again a Gaussian function, but now of the frequency *ω*. A smaller kernel in the spatial domain gives a wider kernel in the Fourier domain, and vice versa.

[![diffusion.gaussian.kernel](https://i.stack.imgur.com/Rqai1.png)](https://i.stack.imgur.com/Rqai1.png)

(Image source: [www.stat.wisc.edu - The Gaussian kernel](http://3.%20The%20Gaussian%20kernel))

The Fourier transform of a Gaussian kernel acts as a low-pass filter for frequencies. The cut-off frequency depends on the scale of the Gaussian kernel. The Fourier transform has the same Gaussian shape. The Gaussian kernel is the only kernel for which the Fourier transform has the same shape.

If you apply the same fft to a grayscale version of the image then what is happening may become a bit clearer. But essentially, the fft is a tool you can use for image processing to achieve different results. Most of these functions are pre-packaged into blur filters, noise reduction functions, edge detection and so on. 

One example of how fft is used is a function to automatically rotate an image of a page of text so that the lines of text are horizontal in the image.