This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: RUTGERS UNIVERSITY School of Electrical and Computer Engineering ECE 447 Fall Course Laboratory No. 3 Solutions Image Processing in MATLAB – Fourier Analysis and Filtering of Images 1 Preliminaries You can access MATLAB toolkits from either the departmental computers in CoRE Room 548 or from any computer with both Matlab and the Image Processing Toolbox. The image files referenced in this lab can be accessed from the course website at: cronos.rutgers.edu/~lrr/ If you are a new Matlab user, try running the built-in demos. Just type demos at the Matlab prompt. 2 Exercise 1 – 2-D Fourier Transforms As we learned in class, given an image f ( x,y ) defined for x = 0 , 1 ,...,M- 1 and y = , 1 ,...,N- 1, the 2-D discrete Fourier transform (DFT) of f ( x,y ) is denoted by F ( u,v ) and is given by: F ( u,v ) = M- 1 X x =0 N- 1 X y =0 f ( x,y ) e- j 2 πux/M e- j 2 πvy/N and is defined for u = 0 , 1 ,...,M- 1 and v = 0 , 1 ,...,N- 1. Similarly the inverse discrete Fourier transform is given by: f ( x,y ) = 1 MN M- 1 X u =0 N- 1 X v =0 F ( u,v ) e j 2 πux/M e j 2 πvy/N again for x = 0 , 1 ,...,M- 1 and y = 0 , 1 ,...,N- 1. The Matlab routines for computing the 2-D DFT and the inverse 2-D DFT are the routines fft2 and ifft2 . Using the image files hardware.tif , shuttle.tif , and xray.tif , read in each of the images and compute the 2-D DFT magnitude for each of the images. On a single plot (using a grid of 2 x 2 images), plot the following: • the original gray scale image in the upper left cell 1 • the image representation of the 2-D DFT magnitude of the image being studied in the upper right cell • a clipped and scaled version of the 2-D DFT magnitude that is clipped and scale at a level where you can see the nature of the 2-D DFT magnitude for each image; this plot should be placed in the lower left cell • the log transformed 2-D DFT magnitude plotted again on a scale that enables you to see the structure of the transform magnitude; this plot should be placed in the lower right cell You will need to use the Matlab routine FS=fftshift(F) to shift the DC magnitude point from the upper left corner of the image to the center of the magnitude range. In your Lab 3 report, include the Matlab code along with image plots of the three images for which you repeat the analysis. Can you say how the image properties (in a gross sense) are seen in the 2-D DFT magnitude plots? *************************************************************************** SOLUTION The Matlab code for reading in an image file, computing the magnitude spectrum, and plotting the requested images is as follows: % plot_image_transform % % f=imread(’shuttle.tif’,’tiff’); % f=imread(’xray.tif’,’tiff’); f=imread(’hardware.tif’,’tiff’); % plot original image in first quadrant figure(1),subplot(221),imshow(f); stitle=sprintf(’original tif file’); title(stitle); % compute image spectrum magnitude and plot in second quadrant F=abs(fftshift(fft2(f))); subplot(222),imshow(F, [...
View Full Document
- Fall '08
- Image processing, Low-pass filter