Sunteți pe pagina 1din 2

ECE 5273 Homework 5

Spring 2012 Dr. Havlicek

1. The images in this problem are all of size 8 8. Some of the images are real-valued; in this case, each pixel is a oating point number (use oat arrays in C). Some of the images are also complex-valued; in C you must use one oat array for the real part and another oat array for the imaginary part. (a) Let I1 be dened by I1 (i, j) = 2 1 exp 1 (u0 i + v0 j) , 2 8

where i = COLUMN, j = ROW, u0 = 2 cycles per image (cpi) is the horizontal frequency, and v0 = 2 cpi is the vertical frequency. Show the real and imaginary parts of I1 as gray scale images with 8 bits per pixel (bpp) and full-scale contrast. Compute the DFT I1 and center it so that the frequency origin is in the middle (this is done automatically by the C function fft2d). Print out the real and imaginary parts of I1 as 8 8 ascii oating point arrays. Whether you use Matlab, C, or some other language, be sure to format the output so that it is easy to read (the columns should line up and the rows should not line-wrap). (b) Let I2 be dened by I2 (i, j) = 2 1 exp 1 (u0 i + v0 j) . 2 8

Show the real and imaginary parts of I2 as 8 bpp gray scale images with full-scale contrast. Compute the centered DFT I2 and print out the real and imaginary parts of I2 as 8 8 ascii oating point arrays. (c) Let I3 be dened by I3 (i, j) = cos 2 (u0 i + v0 j) . 8

Note: I3 = I1 + I2 . Show I3 as as an 8 bpp gray scale image with full-scale contrast (it should look the same as the real part of I1 ). Print out the real and imaginary parts of the centered DFT I3 as 8 8 ascii oating point arrays. (d) Let I4 be dened by I4 (i, j) = sin Note: I4 = 1(I1 I2 ). Show I4 as as an 8 bpp gray scale image with full-scale contrast (it should look the same as the imaginary part of I1 ). Print out the real and imaginary parts of the centered DFT I4 as 8 8 ascii oating point arrays. 2 (u0 i + v0 j) . 8

(e) Let I5 be dened by I5 (i, j) = cos 2 (u1 i + v1 j) , 8

where u1 = 1.5 cpi is the horizontal frequency and v1 = 1.5 cpi is the vertical frequency. Show I5 as an 8 bpp gray scale image with full-scale contrast and print out the real and imaginary parts of I5 as 8 8 ascii oating point arrays. Discuss the appearance of I5 as compared to I1 - I4 . 2. Obtain the image lena.bin from the course web site. We will call this image I. (a) Compute the image J1 = AVE[I, B], where B = SQUARE(49) and where the reference point is the center pixel of B (this is just a 77 average lter). Compute the image J1 by looping over image pixels and handle edge effects by periodic extension of the image I. This makes the operation equivalent to the circular convolution J1 = I B. Show the original and ltered images as 8 bpp gray scale images with full-scale contrast. (b) Compute the centered log-magnitude spectrum log[1 + | I |] and show it as an 8 bpp gray scale image with full-scale contrast. (c) Now implement the same ltering operation as in part (a) above by pointwise multiplication of DFTs. Let the 256 256 image K represent the window B, so that K has 49 1 pixels with value 49 and the rest of the pixels in K are equal to zero. The center of the square window should be the upper left corner of K, so that the square is split across the four corners of the image K. Show the image K and its centered log-magnitude spectrum as 8 bpp gray scale images with full-scale contrast. Compute the DFT of the result image J2 by spectral multiplication according to J2 = I K. Use the inverse DFT to compute the image J2 . Show J2 and its centered log-magnitude spectrum as 8 bpp gray scale images with full-scale contrast. Note: you should see that J1 = J2 .

DUE: 3/28/2012

S-ar putea să vă placă și