Title: COM366
1Topic 14
THE FREQUENCY DOMAIN
COM366
2Basic wave properties
COM366
3In a very real sense the A and B coefficients
define or fully describe the square wave
COM366
4The set of coefficients for the square wave
COM366
5Fourier series in 2 dimensions
COM366
6- using the FFT
- The transform works most efficiently when the
image dimensions are multiples of 2 (e.g. 128,
256 etc.). It will however work with other
dimensional ranges. - The transform generates both an amplitude and
phase for each frequency component. Both are
equally important but usually only the amplitude
component is displayed because the phase is very
difficult to interpret visually. - As an alternative to amplitude and phase the
transform can be expressed as a set of complex
numbers Z X iY where X is the real part and Y
the imaginary part. In this case it is usually
the intensity which displayed. - The transform is a periodic function of which
only one cycle is displayed. The transform also
assumes that the original image is periodic with
only one cycle visible. Occasionally this can
cause unwanted artefacts on the processed image. - Left by itself the FFT will produce a graph in
which the zero frequency appears in the corners
and the highest frequency in the centre, MATLAB
provides a simple function to rectify this.
COM366
7Using the Fourier transform in MATLAB
function FFTDemo(SW) To demonstrate the 2D Fast
Fourier Transform SW is the width (pixels) of a
white stripe in a 256 x 256 square A
zeros(256,256) if SW gt 50 SW 50 end LL
128 - round(SW/2) UL 128
round(SW/2) A(1255,LLUL) 1 subplot(1,2,1),
imshow(A) F fft2(A) F1 fftshift(F) F2
abs(F1) subplot(1,2,2), imshow(F2,-1
8,'notruesize') colormap(jet)
colorbar improfile
COM366
8The Fourier transform of a thin line
COM366
9The Fourier transform of a block
COM366
10Designing a low pass filter
The Butterworth filter
COM366
11The low pass Butterworth filter in practice
C 50 n 1
C 50 n 5
COM366
12function MothDemo(cutoff,order) To demonstrate
the 2D Fast Fourier Transform on a real object A
imread('moth9.gif') B double(A)/255 subplot(
2,2,1), imshow(B) Calculate and display its
Fourier transform F fft2(B) F1
fftshift(F) F2 abs(F1) subplot(2,2,2)
imshow(F2,-1 32)colormap(gray) Get the image
size row col size(B) Now define the
appropriate Butterworh Filter bwlpf
zeros(row,col) centre_row round(row/2) centre_
col round(col/2) for v 1col for u
1row bwlpf(u,v) 1 / (1
(sqrt((u-centre_row)2 (v-centre_col)2)/cutoff)
(2order)) end end bwlpf fftshift(bwlpf) su
bplot(2,2,3) imshow(bwlpf) F F .
bwlpf F_lpf real(ifft2(F)) subplot(2,2,4)
imshow(F_lpf)
COM366
13COM366
14The high pass Butterworth filter
C 50 n 1
C 50 n 5
COM366
15COM366