You are on page 1of 2

EE 3512 - Signals Dr.

Obeid

Computer Assignment 5

Fall 2011 Due in class Wednesday December 7

Goal The goal of this computer assignment is to introduce you to the world of image processing, and to demonstrate that much of the math and intuition youve learned this semester are useful for processing images. Believe it or not, images have frequency content (spatial frequency, not temporal frequency) and can be high and low-pass ltered to do things like de-noising, edge detection, and smoothing. You will be using the Matlab Image Processing Toolbox to perform the steps in this assignment. Documentation Mathworks has placed extensive documentation for the Image Processing Toolbox online at http: //www.mathworks.com/help/toolbox/images. There is lots of good information there that will give you a good starting point for thinking about image processing. However, if you dont want to read the whole thing then at a bare minimum you should read http://www.mathworks.com/help/ toolbox/images/f16-14527.html so you understand the concept of 2D convolution. Part 1 Download the le hw5Data.mat from Blackboard. Inside it you should nd eight images named im1 through im8. You can view an image by typing: imshow(im1,[],InitialMagnification,fit); You can also plot the Fourier Transform of an image by typing: freqz2(f1,512) Note that the x- and y-axes represent normalized frequency. A normalized frequency of 1 represents exactly half of the sampling frequency, or in other words, the highest possible discrete-time frequency (essentially equivalent to = rads/sample). Examine the frequency contents of the eight images and explain their corresponding Fourier Transforms. Specically: Compare im1, im2, and im3 Compare im1 with im4 Compare im5, im6, and im7 In each case, explain how the dierences in the images correlate to the dierences in the Fourier Transforms. You should be able to apply all of your signal processing intuition to answering these questions. Part 2 Here you will create and compare low-pass image lters using a built-in Matlab function called fspecial. To create a 3x3 low-pass lter, use the command: h = fspecial(average,3); Use the freqz2 command to examine the magnitude response of this lter. Does it look like a 2D low-pass lter? Finally, apply the lter to an image. Matlab has some pre-saved images you can use, or you can try importing your own. moon = imread(moon.tif); moonLPF = imfilter(h,moon);
Page 1 of 2

EE 3512 - Signals Dr. Obeid

Computer Assignment 5

Fall 2011 Due in class Wednesday December 7

Compare your moon image before and after ltering. Has your image been low-pass ltered? How can you tell? Repeat this process for several dierent strengths of low-pass lter (i.e. increase the 3 in the fspecial command to a higher integer). Compare the lter magnitude response (freqz2) with the ltered image. Are the ltered images what you expect? Extra Credit Choose either one of the following two design problems. You only need to do one of them!. In both cases, you will need to read the Image Processing Toolbox help page titled Designing Linear Filters in the Frequency Domain. Option A Design a 2D high-pass lter. Show the magnitude response (which should conrm it is a high-pass lter), and show an image that has been processed with your lter. Does the image look like it has been high-pass ltered (i.e. what does high-pass ltering mean for an image)? Option B The hw5Data.mat le has two images in it named pears (a picture of some pears) and pears noisy (the pears picture plus white noise). Recall that white noise is noise that exists at all frequencies. Create a lter to try to remove some of that white noise. There is no perfect solution: just do the best you can and explain your ltering strategy. You can work in teams of up to two people. Write up your ndings in a report of whatever length you choose. Code should be zipped into a single le and emailed to me at iobeid@temple.edu.

Page 2 of 2

You might also like