Docsity

Image Processing Machine Problem 1: FFT Analysis and Low-Pass Filtering - Prof. Thomas S. , Exams of Electrical and Electronics Engineering

Toggle sidebar
bg1
ECE547 Image Processing Aug 28, 2008
Machine Problem 1
Lecturer: Prof. Thomas Huang Due: Sept 11, 2008
1 Introduction
For this machine problem, you will learn the MATLAB functions for computing 2D DFT and
inverse 2D DFT, and become familiar with basic matrix operations. You will also examine effects
occurred to each image as a result of applying different operations in the frequency domain.
2 Description
You are asked to write a MATLAB program to perform the following tasks for the given test
images. (Hint: You may want to consider the following MATLAB functions: imread,imwrite,
fft2,ifft2,fftshift,abs, and angle.)
2.1 FFT Analysis
For the following tasks, please run them on the following two images:
•http://courses.ece.uiuc.edu/ece547/mp/lena.png
•http://courses.ece.uiuc.edu/ece547/mp/beckman.jpg
When saving your output, replace xxx with lena and beckman as appropriate. For example,
the output of task 1 with beckman.jpg should be beckman1-mag.png and beckman1-ang.png1.
1. Compute the DFT F(x;y) and display the magnitude and phase of F(x;y). Save the magni-
tude as xxx1-mag.png and the phase as xxx1-ang.png.
2. Keep the magnitude of F(x;y) and set the phase to 0 for each frequency sample. Take the
inverse DFT and compare the results to the original images. Save the result as xxx2.png.
3. Keep the phase of F(x;y) and set the magnitude to unity for each frequency sample. Take
the inverse DFT and compare the results to the original image. Save the result as xxx3.png.
4. Keep the phase of F(x;y) and replace the magnitude of each frequency sample by its square
root. Take the inverse DFT and compare the results to the original image. You should observe
an edge enhancement. Save the result as xxx4.png.
1Since the source for the Beckman image was a jpeg, we kept the format. However, we usually save image
processing results as png or other lossless formats to preserve fidelity.
MP1-1
pf2

Partial preview of the text

Download Image Processing Machine Problem 1: FFT Analysis and Low-Pass Filtering - Prof. Thomas S. and more Exams Electrical and Electronics Engineering in PDF only on Docsity!

ECE547 Image Processing Aug 28, 2008

Machine Problem 1

Lecturer: Prof. Thomas Huang Due: Sept 11, 2008

1 Introduction

For this machine problem, you will learn the MATLAB functions for computing 2D DFT and inverse 2D DFT, and become familiar with basic matrix operations. You will also examine effects occurred to each image as a result of applying different operations in the frequency domain.

2 Description

You are asked to write a MATLAB program to perform the following tasks for the given test images. (Hint: You may want to consider the following MATLAB functions: imread, imwrite, fft2, ifft2, fftshift, abs, and angle.)

2.1 FFT Analysis

For the following tasks, please run them on the following two images:

  • http://courses.ece.uiuc.edu/ece547/mp/lena.png
  • http://courses.ece.uiuc.edu/ece547/mp/beckman.jpg

When saving your output, replace xxx with lena and beckman as appropriate. For example, the output of task 1 with beckman.jpg should be beckman1-mag.png and beckman1-ang.png^1.

  1. Compute the DFT F (x; y) and display the magnitude and phase of F (x; y). Save the magni- tude as xxx1-mag.png and the phase as xxx1-ang.png.
  2. Keep the magnitude of F (x; y) and set the phase to 0 for each frequency sample. Take the inverse DFT and compare the results to the original images. Save the result as xxx2.png.
  3. Keep the phase of F (x; y) and set the magnitude to unity for each frequency sample. Take the inverse DFT and compare the results to the original image. Save the result as xxx3.png.
  4. Keep the phase of F (x; y) and replace the magnitude of each frequency sample by its square root. Take the inverse DFT and compare the results to the original image. You should observe an edge enhancement. Save the result as xxx4.png. (^1) Since the source for the Beckman image was a jpeg, we kept the format. However, we usually save image

processing results as png or other lossless formats to preserve fidelity.

MP1-

  1. Low-pass filter the test images. First use the rectangular low pass filter

H(x; y) =

1 |x| < Cx and |y| < Cy, 0 otherwise

where Cx and Cy are the normalized cut-off frequencies for x and y respectively. The nor- malization is such that the “whole image” ranges from −1 to 1. Start with Cx = Cy = 0.3. Save the result as xxx5a.png. Then try another low-pass filter and save that result as xxx5b.png. You may try a different Cx and Cy or use another filter entirely.

2.2 Image Cleanup (Lena’s Jailbreak)

Use frequency domain methods (Hint: use a band-pass filter) to remove the black bars in lena-bar.png. This image may be found at http://courses.ece.uiuc.edu/ece547/mp/lena-bar.png. Save the result as lena-bar-clean.png.

3 Hand-in

Please create an archive of your work named netid.zip or netid.tar.gz, where netid is your NetID. In this archive, include:

  1. Source code for performing the tasks above. If you performed the task on the command line, consider using the command history or the diary function.
  2. All of the images mentioned above.
  3. A short report (plain text will be fine, doc or pdf will be accepted) which includes:

(a) Your name. (b) Your observations on the results of tasks 2–4. (c) Your choice of a low-pass filter for task 5 and a comparison between the two low-pass filter results. (d) A brief description of how you cleaned up lena-bar.png

Email a copy of the archive to [email protected]

4 Additional Resource

MathWorks Inc. provides an excellent documentation on how to use MATLAB. You may learn more about MATLAB from their website at: http://www.mathworks.com/access/helpdesk/help/techdoc/matlab.shtml

MP1-