Objective
Objective
THEORY:
The general idea is that the image (f(x,y) of size M x N) will be represented in the frequency domain
(F(u,v)). The equation for the two-dimensional discrete Fourier transform (DFT) is:
Eq 1
The inverse of the above discrete Fourier transform is given by the following equation:
Eq 2
Thus, if we have F(u,v), we can obtain the corresponding image (f(x,y)) using the inverse, discrete Fourier
transform.
15
The mesh plot of the magnitude is a common way to visualize the Fourier transform.
The peak at the center of the plot is F (0,0), which is the sum of all the values in f(m,n) and is often called
the ‘DC component’. The plot also shows that F (ω1, ω2) has more energy at high horizontal frequencies
than at high vertical frequencies. This reflects the fact that horizontal cross sections of f(m,n) are narrow
pulses, while vertical cross sections are broad pulses. Narrow pulses have more high-frequency content
than broad pulses.
Another common way to visualize the Fourier transform is to display log|F(ω1, ω2)| as an image, as
shown in Fig.7.2.
Using the logarithm helps to bring out details of the Fourier transform in regions where F (ω1, ω2) is
very close to 0.
Examples of Fourier transform for other simple shapes are shown in Fig.7.3
16
Fig.7.3 Fourier transform of some simple shapes
There are two principal reasons for using discrete Fourier transform:
1. The input and output of the DFT are both discrete, which makes it convenient for computer
manipulations.
2. There is a fast algorithm for computing the DFT known as the fast Fourier transform (FFT).
17
MATLAB has three related functions that compute the inverse DFT:
ifft
ifft2
ifftn
The following table is meant to describe the various steps behind displaying the Fourier Spectrum.
imshow(f,'InitialMagnification', 'fit')
18
%To create a finer sampling of the Fourier
transform, you can add zero padding to f when
computing its DFT. Also note that we use a power
of 2, 2^256. This is because the FFT -Fast Fourier
Transform - is fastest when the image size has
many factors.
F=fft2(f, 256, 256);
F2=abs(F);
figure, imshow(F2, [])
19
Tasks:
1. What prod(size(imgFT)) function in MATLAB does. Apply it to above image and conclude on it.
2. The spectrum of DFT is complex. What does this complex spectrum contain?
3. The signs of real and imaginary part of spectrum are relevant in which calculation?
4. Why logarithmic is applied in calculating amplitude?
5. Select one image of natural scene and one image of texture. Compute their DFT in MATLAB as
well as their amplitude and phases. Which part of the spectrum contains the largest portion of
the energy
6. Does phase of the spectrum contains more information than magnitude of the spectrum?
7. If answer to task 6 is yes. Prove it by reading an image file and compute their magnitude and
phase versions of the image separately and plot them on a common plot. Discuss the plot
8. Task 7 is complicated. Refer MATLAB for help in different commands. Use MATLAB command
angle to compute the phase simply.
Write a MATLAB code for reconstructing the full image based on the crossed images of magnitude and
phase.
Conclusion:
20