Frequency Domain Processing

Computing and Visualizing 2D DFT
1. Fast fourier transform algorithm is used to obtain DFT and its inverse.
2. The function fft2 is used to obtain the FFT of an M N image array,
having syntax:
F = fft2 (f)
3. In order to use FFT for filtering, the input image must be padded with
zeros, having syntax:
F = fft2 (f, P, Q)
4. The function abs is used to obtain the fourier spectrum of the array,
having syntax:
S = abs (F)
5. The origin of the transform can be moved to the center of the frequency
rectangle by using the function fftshift, having syntax:
Fc = fftshift (F)
6. Function ifftshift reverses the centering, having syntax:
F = ifftshift (Fc)
7. The function ifft2 is used to obtain the inverse fourier transform, having
f = ifft2 (F)
8. In order to compute the inverse to obtain an image consisting only of real
values, function real is used, having syntax:
f = real (ifft2 (F))

Basic Steps in DFT Filtering
1. Obtain the padding parameters using function paddedsize:
PQ = paddedsize (size(f));
2. Obtain the Fourier transform with padding:
F = fft2 (f, PQ(1), PQ(2));
3. Generate a filter function, H, of size PQ(1) PQ(2). The filter must be
selected whose input is not centered. If it is centered instead, use
command H = fftshift (H) before using the filter.
4. Multiply the transform by the
G = H.*F;
5. Obtain the real part of the inverse
FFT of G:
g = real (ifft2(G));
6. Crop the top, left rectangle to the
original size:
g = g (1:size(f, 1), 1:size(f, 2));

Obtain Frequency Domain Filters from Spatial Filters
1. Spatial domain filtering is more efficient computationally than that of
frequency domain.
2. The frequency response of FIR filters is computed by using the function
freqz2, having syntax:
H = freqz2(h, R, C)
3. The resultant is the desired filter in frequency domain.

Generating Filters Directly in the Frequency Domain
1. Creating Meshgrid arrays for use in implementing filters in the frequency
a. The distance computations are with respect to the top, left of the
frequency rectangle because FFT computations assume that the
origin of the transform is at that point.
b. The function fftshift can be used to rearrange the data for
c. Function dftuv provides the necessary meshgrid array.
2. Low pass frequency domain filters
a. An ideal low pass filter has a transfer function as:
H(u,v) = {
b. A Butterworth low pass filter of order n, with a cut off frequency at a
distance D0 from the origin, has transfer function as:
H(u,v) =
1 if D(u,v) <= D0
0 if D(u,v) > D0
1 + [D(u,v)/D0]
d. The transfer function of Gaussian low pass filter is:
H(u,v) = e
3. Wireframe and surface plotting
a. Mesh function is used to draw the wireframe of a 2-D function,
having syntax:
mesh (H)
b. Wireframe plot for every kth point is drawn by using the syntax:
mesh (H(1:k:end, 1:k:end))
-D (u,v)/2(sigma) 2 2
c. Sometimes it is desirable to plot a function as a surface instead
of a wireframe which can be done by using surf function, having
surf (H)
d. The faceted shading can be smoothed and mesh lines are
eliminated by interpolation by using the command:
shading interp

Sharpening Frequency Domain Filters
1. Basic high pass filtering:
Given the transfer function Hlp (u,v) of a low pass filter, the transfer
function of corresponding high pass filter can be obtained by using the
simple relation
Hhp (u,v) = 1 – Hlp (u,v)
2. High frequency emphasis filtering:
High pass filters reduce the average value of an image to 0 because they
zero out the dc term. To compensate this an offset is added to a high
pass filter. When an offset is combined with multiplying the filter by a
constant greater than 1, the approach is called high frequency emphasis
Filtering, having transfer function as:
Hhfe (u,v) = a + b Hhp (u,v)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s