Gaussian kernel in the frequency domain

In this section, we will see how the Gaussian kernel looks like in the frequency domain in 2D and 3D plot.

The Gaussian LPF kernel spectrum in 2D

The next code block shows how to plot the spectrum of a Gaussian kernel in 2D with the log transform:

im = rgb2gray(imread('../images/lena.jpg'))
gauss_kernel = np.outer(signal.gaussian(im.shape[0], 1), signal.gaussian(im.shape[1], 1))
freq = fp.fft2(im)
freq_kernel = fp.fft2(fp.ifftshift(gauss_kernel))
pylab.imshow( (20*np.log10( 0.01 + fp.fftshift(freq_kernel))).real.astype(int), cmap='coolwarm') # 0.01 is added to keep the argument to log function always positive
pylab.colorbar()
pylab.show()

The following screenshot shows the output of the preceding code with a color bar. Since the Gaussian kernel is a low-pass filter, its frequency spectrum has higher values for the frequencies in the center (it allows more low-frequency values), and gradually decreases as one moves away from the center to the higher frequency values:

The next screenshot shows the frequency spectrum of the Gaussian kernel in 3-D, with and without the logarithm scale, along the response axis. As can be seen, the DFT of a Gaussian kernel is yet another Gaussian kernel. The Python code for the 3-D plots are left as an exercise (Question 3, with hints) for the reader.

The Gaussian LPF kernel spectrum in 3D

The horizontal plane represents the frequency plane and the vertical axis the response of the Gaussian kernel in the frequency domain, without and with the logarithm axis, respectively:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.147.77