E186 Project 4 (due March 27)


This project is about filtering in the frequency (sequency) domain using discrete Fourier transform (DFT), discrete cosine transform (DCT), and Walsh-Hadamard transform (sequency ordered or Walsh ordered, WHT_w). Choose any image you like. But make sure that the content of the image is rich enough so that it has a wide spectrum with both high and low frequency components. (/imagedata/panda.pgm is a good candidate). To enjoy the fast algorithms, you may need to resize or crop (XV can do both) the image so that both its width and height are a power of 2.
  1. Spatial Frequency Filtering with DFT

  2. Spatial frequency Filtering with DCT

    Use the 1D fast DCT function contained in a sample program "/e186/programs/myfdct.c" in your own DCT 2D filtering program. Similar to the 2D DFT, here you transform the columns and then the rows to get the 2D spectrum. Print the spectrum as an image (after nonlinear scaling and normalization) to have a visual display of the spectrum. Submit this frequency spectral 2D array as image 5.

    Then both high-pass and low-pass filter the image. Different from the Fourier spectrum, now the lowest frequency component, the DC component, is at the upper-left corner and the highest sequency component is at the lower-right corner of the 2D array of the spectrum. You should design your filters accordingly. To avoid the ringing effects, use any of the smooth filters discussed in class (Gaussian, Butterworth, or Hamming filter). Then inverse transform the filtered spectrum back to the spatial domain and submit the two filtered images as images 6 and 7.

  3. Spatial Sequency Filtering with WHT

    Now do the same for sequency filtering. Use the provided 1D fast WHT function "/e186/programs/mywht.c" in your program. Save the sequency spectrum as an image (after rescaling and normalization) and submit it as image 8.

    Then both high-pass and low-pass filter the sequency spectrum of the image in the same way as 2D DCT filtering (you can use exactly the same code). Then inverse transform the filtered spectrum back to the spatial domain. Note that the inverse transform is identical to the forward transform (How nice!). Submit the two filtered as images 9 and 10.

Take a look at these demos for Fourier and other transforms.