• Project 2

    Project 2 adds a complex floating point class Fclass to handle FFT operations. If you want to keep any Iclass items from project1, cut and paste these functions into the new Iclass provided with this project.

  • Download project

    When you have downloaded the project, the command "tar -xvf p2.tar" will create a directory "p2" containing the project code. Read the readme file.

  • Project tasks:

  • Work in groups of 1 or 2. Students unfamilair with C or C++ should join work in a group with at least one person familiar with C or C++. Students who are unable to find a group will be randomly assigned.

  • Keep explanations to 2 or 3 sentences written directly on the printout of the results. Write your explanations directly on the printout; 2 or 3 sentences should suffice for most explanations.
  • Use "snapshot" for printouts
  • Note "xmag" is a useful utility, try running it.
    The left mouse button can be used to measure pixel coordinates. If the top of xmag is a multi-line menu bar rather than a single line, and if the coordinate feature doesnt work -- type the following line before running xmag:

    setenv XAPPLRESDIR $HOME/xappdef:/usr/openwin/lib/app-defaults

    or, if XAPPLRESDIR is already set in your environment, type:

    setenv XAPPLRESDIR $XAPPLRESDIR:$HOME/xappdef:/usr/openwin/lib/app-defaults

    You can add this to your .cshrc file.

    Part 1

  • Get the basic program running. Load canvas.img. Press the f1 key.
    Observe the resulting FFT. Print this out, and hand it in.
    Explain why the "DC" (u,v) = (0,0) point is in the upper left corner.
    Note that the DC component was set equal to zero in order to suppress this for viewing purposes.
    Use xmag to see this at (0,0).
  • Load sin1.img, and print it out. Press the f1 key.
    sin1 is a 2D sinusoid. Measure the frequency (u,v) of the sinusoid by counting the number of cycles in the spatial image along the xaxis and yaxis. Then compare this against the coordinates (u,v) in the frequency plane, assuming the upper left corner to be (u,v)=(0,0).
    Use the coordinate measurement feature of xmag by holding down the left mouse buttons to measure the coordinates of the sinewave relative to the coordinates of (u,v)=(0,0) in the upper left corner.
    Compute (u,v) in units of cycles/pixel and cycles/image. Hand this computation in (written on the sine1 printout), and compare it to what you expect from the spatial domain image.
  • Comment out the DC suppression in, and observe the change in the plotted spectrum (for canvas). Plot this spectrum.
    What is the actual magnitude of the DC component F(0,0) for canvas.img (print this out as a new line in your program)?
    Why is the DC component so strong?
    Explain and hand in.
  • How many decibels are covered by the range from black to white in the frequency plane images? Note: do not compute the number of dB based on 0-255.
    Turn in your computation on a separate sheet.
    Hint: dB = 10 log10( power ratio )
  • Modify the program to create an Fclass function to shift the frequency plane so that the center of the FFT frequency plane image is (u,v)=(0,0) and the lower right corner is (u,v)=(N/2,N/2). Also have this function perform the logarithmic scaling (rather than cluttering up the main program) and adjust the scaling to display approximately 80 dB range of the power spectrum.
    Use this to create a function to implement the FFT button on the interface.
    In this function, retain DC suppression. Plot the "centered" FFT of canvas.img using your new function and.
    Turn this FFT plot in.
  • From this point on, for the remainder of the course, all frequency plots should be "centered" with (u,v) = (0,0) in the center of the image using the 80 dB range.
  • Look at the FFT of sin1.img, sin2.img, and sin3.img.
  • Observe the FFT of vslit.img, hslit.img, and dslit.img. Plot the results for hslit.img.
    Explain the results in terms of 2D impulse functions.
    What 2D impulse function does dslit.img correspond to?
  • Plot the FFT of circle17.img. Turn this in.
  • Take the FFT of rect5.img. Turn this in. Compare to predicted results in the text.

    Part 2

  • Use the Lowpass key to implement convolution of the displayed image with circle17.img using the FFT.
    Convolve and print the result for pepper.img.
    Turn this plot in. Explain.
    Repeat this operation two more times in succession, and plot the result.
  • Undo the spatial shift problems induced by circle17.img.
    Plot the corrected convolution for pepper.img.
  • Plot the frequency spectrum before and after convolution of pepper.img with circle17.
    Turn these 2 plots in. Explain the results.
  • Convolve the circle with rect5.img and observe the blurred image.
  • Compare the number of multiplications that would be required to implement this convolution with a 17-pixel radius circle using FFT and using "step-and-repeat" in the spatial domain. Turn this in on a separate sheet of paper. (Hint: do you really need to multiply?)
  • Implement (d/dx)f(x,y) using the FFT.
    Use the F2 key.
    Since the result can be negative, let grayscale 127 equal 0. Then black will be negative, and white positive.
    Plot the result for rect17.img. Scale the result to use the full range of gray scale.
    Turn in this plot.
  • Turn in the FFT of the above result. Explain.

    Part 3

  • Plot the histogram of truck.img as a 256x256 image similar to Fig. 4.13(b). Scale the plot so that the maximum is near the top of the image.
  • Histogram equalize the image using Eq. 4.2-9. Plot the original and equalized truck images.
  • Plot the histogram of the equalized image as in Fig. 4.13(d).


    Write a cover sheet plus a 1-page double-spaced summary of the project. Stick to discussion of the results you observed. Include comparisons between predicted and observed results. Include any problems or unresolved issues in the summary. Turn in all results/printouts/explanations with explanations written directly on results printouts. Do not add extraneous pages or put explanations on separate pages unless specifically directed to do so. Turn in all source code as an appendix.

  • Copyright information