HI 5323 Session 8

Overview:

  1. Lecture 1: Noise And Filters (PDF file)
  2. Homework Assignment 3


Homework Assignment 3


Due at the beginning of Session 11.  Submit one of the two alternatives:

Alternative I: Programming Assignment (default for most students):

Download and uncompress the files from here. Then, to create executables under Windows go to the prog3a directory and execute the commands:

   qmake prog3a.pro
make
prog3a ball.jpg (note give a few seconds to load)

The subdirectory prog3a contains a function that computes the 2D Discrete Fourier Transform (DFT) and another function that computes the inverse 2D Discrete Fourier Transform. A complex class and a display class for complex images (such as those resulting from a Fourier Transform) are provided for you in the directory. The complex image display class is called FourierView and allows multiple ways of viewing the complex image values. An image and its DFT is displayed side-by-side in the same window (using a QGroupBox). The images to load and display are to be specified on the command line.

For functions of two dimensions, if g(j,k) stands for an N-by-N array, then its two-dimensional discrete Fourier transform (DFT) is the array G(m,n) given by

                                                              N-1    N-1

G(m, n) = 1 / N  Σ     Σ    g(j, k) e-i2π(mj/N + nk/N)                                (1)

                                                              j=0     k=0

and the inverse DFT is

                                                              N-1    N-1

g(j, k)  =  1 / N   Σ    Σ   G(m, n) ei2π(jm/N + kn/N)                                (2)

                                                              m=0   n=0

 

Since the exponential of equations can be factored, equation 1 can be rewritten in another way: 

                                                             N-1       N-1

G(m, n) = 1 /N  Σ  [    Σ   g(j, k) e-i2π(nk/N) ] e-i2π(mj/N)                    (3)

                                                             j=0        k=0

which allows us to compute the 2D DFT of a signal very conveniently. That is, equation 3 divides the transformation into horizontal and vertical operations. The term in brackets represents one-dimensional DFTs computed on the rows of the image. The outer summation performs columnwise one-dimensional DFT on the resulting array.

In the above implementation of the direct 2D DFT, we first computed a1D DFT on every row of the image, stored the data back into the array. Second, we performed a 1D DFT on every column of the result array. The data in the array is the result of 2D DFT.

For the inverse 2D DFT (Eq. 2), the implementation is similar.


(Assignment Alternative I:)

(Part A) Go to the directory prog3a. Compile the code and apply it to both test images, gull.pgm and ball.pgm. Save the resulting side-by-side windows into a document (e.g. MS Word) for later write-up. (5 pts.)

(Part B)  Go to the directory prog3b. Load the two grayscale images in to a new program created in that directory. Swap the imaginary component of the first FT with that of the second FT, compute the inverse DFT of the resulting complex (frequency space) image and display the resulting image. Next, swap the magnitude of one DFT image with that of the other while keeping the phases in place and compute (and display) the inverse DFT of the resulting complex images. What is more important for preserving image information, magnitude or phase of the FT? (10 pts.)

(Part C)  Go to the directory prog3c. Load and display the image interfere.pgm and its DFT. Determine where the high frequency spike(s) occurs in the image’s spectrum (preferably automatically using the Power spectrum, but manually with hard-coded positions will suffice) and scale the complex value at those positions such that its magnitude is the average magnitude of the 8 neighboring pixels (do not include the spike pixel when computing the average). (Remember that a spike corresponding to a sinusoid of a given frequency and direction has a negative or mirrored component). Compute the inverse DFT and redisplay the resulting image. (10 pts.)

 (Write-up)  Submit a write-up describing how you implemented this programming assignment and what you learned. What happens when you swap the imaginary components of two FTs and then reconstruct the images? What about when the phases are swapped? Which component of the complex number (in terms of either real/imaginary or magnitude/phase) seems to dictate the amount of the various gray levels and which component controls the spatial positioning information? What insights did you learn about the Fourier Transform by looking at the various spectra of some of these synthetic test images? What happened to the resulting image when you removed the high frequency spike in part C? This write up, with embedded images, is to be turned in online with the program submission as an e-mail attachment. Make sure the attachment is smaller 5MB by removing all object files and executables and zip into one file. (5  pts.)


Alternative II: Paper Assignment (requires special agreement by instructor):

Human color perception.  Review the following textbook in an 8-10 page paper:  Color, Environment, & Human Response by Frank H. Mahnke. This book can be borrowed from the instructor. Summarize the main findings and opinions of the author. What are the implications of modern color theory on the design of health care facilities, mental health centers and psychiatric hospitals?  How can one remedy eye fatigue at the office workspace? How would you design a computer office environment?