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
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.
(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.)
Human color perception. Review the following textbook
in an 8-10 page paper: Color,
Environment, & Human Response by . 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?