CSE/EE 485:  Digital Image Processing I

Computer Project Report # : Project 3

Fourier Transform and Frequency Domain Filter Design

Group #4: Isaac Gerg, Pushkar Durve

Date: November 4, 2003


A.  Objectives
  1. Study how to compute forward 2D FFT by finding the log magnitude & phase and the inverse 2D FFT.
  2. Study Lowpass Filter Design using FSPECIAL to design an 11x11 Gaussian lowpass filter.  Compute the forward 2D FFT of the filter kernel and study the SIZE function.
  3. Study Highpass Filter Design using FSPECIAL to design a laplacian highpass filter.  Study how to compute and plot the inverse 2D FFT of the highpass filtered image using IFFT2 function
  4. Study the Two Dimensional Filter Design and utilize the filter design functions: FSAMP2, FWIND1, and FWIND2.
  5. Study Two Dimensional Filter Design by using image FREQSPACE function to design the sampling grid for the filter
B. Methods
There is one 'M' file for this project.

project3.m contains four parts.

1. 2D FFT
2. Lowpass filter design
3. High Pass Filter Design
4. 2D Filter Design

Executing project3.m from Matlab

At the command prompt enter:

>>project3

 

C. Results
Image file names in parentheses.

Results described in order following Methods section above.

Part 1:


Figure 1: Original image. (lenna.gif)


Figure 2: Plots of original image, log & phase FFT of orginal image, and inverse FFT (index.1.jpg)

Part 2:


Figure 3: Plot of log & phase magnitude for lowpass filter (index.2.jpg)

 


Figure 4: Plots of log magnitude, phase, and inverse FFT of lowpass filterd image (index.3.jpg)

Part 3:


Figure 5: Plot of log & phase magnitude for highpass filter (index.4.jpg)


Figure 6: Plots of log magnitude, phase, and inverse FFT of lowpass filterd image. (index.5.jpg)

Part 4:


Figure 7: Plots of log magnitude & phase for Bandpass filter spectrum using Fsamp2 function (index.6.jpg)


Figure 8: Plots of log magnitude & phase for lowpass filter spectrum using Fsamp2 function. (index.7.jpg)


Figure 9: Plots of log magnitude & phase for highpass filter spectrum using Fsamp2 function. (index.8.jpg)


Figure 10: Plots of log magnitude & phase and inverse FFT for 
Bandpass filtered  image using Fsamp2 function.  (index.9.jpg)

 


Figure 11: Plots of log magnitude & phase and inverse FFT for Lowpass
filtered image using Fsamp2 function. (index.10.jpg)


Figure 12: Plots of log magnitude & phase and inverse FFT for Highpass
filtered image using Fsamp2 function. (index.11.jpg)


Figure 13: Log magnitude and phase plots for Bandpass Filtered Image using Fwind1 function. (index.12.jpg)


Figure 14: Log magnitude and phase plots for Highpass Filtered Image using Fwind1 function. (index.13.jpg)


Figure 15: Log magnitude and phase plots for Lowpass Filtered Image using Fwind1 function. (index.14.jpg)


Figure 16: Log magnitude, phase, and Inverse FFT plots for
Bandpass Filtered Image using Fwind1 function. (index.15.jpg)

 


Figure 17: Log magnitude, phase, and Inverse FFT plots for
Lowpass Filtered Image using Fwind1 function.  (index.16.jpg)


Figure 18: Log magnitude, phase, and Inverse FFT plots for
Highpass Filtered Image using Fwind1 function.  (index.17.jpg)


Figure 19: Log magnitude and phase plots for Bandpass Filtered Image using Fwind2 function. (index.18.jpg)


Figure 20: Log magnitude and phase plots for Highpass Filtered Image using Fwind2 function. (index.19.jpg)


Figure 21: Plots of log magnitude & phase for Lowpass filtered image using Fwind2 function. (index.20.jpg)


Figure 22: Log magnitude, phase, and Inverse FFT plots for
Bandpass Filtered Image using Fwind2 function. (index.21.jpg)

 


Figure 23: Log magnitude, phase, and Inverse FFT plots for
Lowpass Filtered Image using Fwind2 function. (index.22.jpg)


Figure 24: Log magnitude, phase, and Inverse FFT plots for
Highpass Filtered Image using Fwind2 function.  (index.23.jpg)


Summary
All results were as expected in the experiment.  See conclusion about bandpass, lowpass, and highpass filters.

 

D. Conclusions

The Fast Fourier Transform (FFT) is the most widely known example of the Spectral method for computational problems.  In Fourier transformations, the mapping is from the time-domain to the frequency-domain. The FFT is widely used in the field of image processing, where one commonly describe an image in terms of intensity values in a two-dimensional matrix.

Better results can be achieved with a Gaussian shaped filter function. The advantage is that the Gaussian has the same shape in the spatial and Fourier domains and therefore does not incur the ringing effect in the spatial domain of the filtered image. A commonly used discrete approximation to the Gaussian is the Butterworth filter. Applying this filter in the frequency domain shows a similar result to the Gaussian smoothing in the spatial domain. One difference is that the computational cost of the spatial filter increases with the standard deviation (i.e. with size of the filter kernel), whereas the costs for a frequency filter are independent of the filter function. The spatial Gaussian filter is more appropriate for narrow lowpass filters, while the Butterworth filter is a better implementation for wide lowpass filters.  The same principles apply to highpass filters. We obtain a highpass filter function by inverting the corresponding lowpass filter, e.g. an ideal highpass filter blocks all frequencies smaller than Do and leaves the others unchanged.

The form of the filter function determines the effects of the operator. There are basically three different kinds of filters: lowpass, highpass and bandpass filters. A low-pass filter attenuates high frequencies and retains low frequencies unchanged. The result in the spatial domain is equivalent to that of a smoothing filter; as the blocked high frequencies correspond to sharp intensity changes, i.e. to the fine-scale details and noise in the spatial domain image.

Bandpass filters are a combination of both lowpass and highpass filters. They attenuate all frequencies smaller than a frequency Do and higher than a frequency D1, while the frequencies between the two cut-offs remain in the resulting output image. We obtain the filter function of a bandpass by multiplying the filter functions of a lowpass and of a highpass in the frequency domain, where the cut-off frequency of the lowpass is higher than that of the highpass.

A highpass filter, on the other hand, yields edge enhancement or edge detection in the spatial domain, because edges contain many high frequencies. Areas of rather constant graylevel consist of mainly low frequencies and are therefore suppressed.

A bandpass attenuates very low and very high frequencies, but retains a middle range band of frequencies. Bandpass filtering can be used to enhance edges (suppressing low frequencies) while reducing the noise at the same time (attenuating high frequencies).

The fwind1 function designs two-dimensional filters using the window method. fwind1 uses a one-dimensional window specification to design a two-dimensional filter based on the desired frequency response.  fwind1 works with one-dimensional windows only.

The fwind2  function is used to design two-dimensional filters using the window method.  The fwind2 uses a two-dimensional window specification to design a two-dimensional filter based on the desired frequency response.  The fwind2 works with two-dimensional windows.

The fsamp2 designs two-dimensional filters based on a desired two-dimensional frequency response sampled at points on the Cartesian plane.

The fsamp2, fwind1, and fwind2 functions are used to model our ideal filters in such a way that it has a realizable signal. Ideal filters cannot be physically realized. For example,  the impulse response of an ideal low pass filter implies a noncausal system 1.

Windowing is done to isolate part of the signal of interest. However, using a sharp truncation of a function, such as a step function, can result in spectrum-leakage distortion 1. To correct this, windowing functions are introduced to make this truncation gradual. Fwind1 and Fwind2 perform these windowing functions.

   
E. Appendix

project3.m source code.

 

F. Works Citied

1. Parr & Phillips. Signal, Systems, & Transforms. 1999: Prentice Hall. New Jersey 07458. Pages 249, 568-9.