Project 4


As always, add your last name in front of the image names specified below and submit them to ``/students/proj4''. This project contains two parts:

Part I

  1. Color Image Processing
    The purpose here is to improve the appearance of a color image of your choice. There are quite a few color images here. You may also want to scan in a color photo of personal interest. However, make sure that there is plenty of room for quality improvement in the color image chosen in terms of contrast, color saturation, and color biase (e.g., some color photos are too blue or red due to improper exposure and/or development), so that the effect of your processing will be most significant. Submit the color image of your choice as image 0.

    Note: Two pairs (four) of RGB-HSI conversion functions are provided in this program. They are based on, respectively, the RGB cube color model and the HSV hexcone model. Go through the code to make sure you understand how the conversion is done before you use it. For example, you should know that the intensity in the function is represented by a value between 0 and 1 (instead of 0 and 255!). Try both color models for the following and submit the better one for each. Comment on the difference (or similarity) between the two, if any.

    (a) Increase the dynamic range of the intensity I of the image by linearly stretching its intensity histogram while keeping the hue and saturation unchanged. Submit the result as image 1.

    (b) Increase the saturation S of the image while keeping their hue and intensity unchanged. Submit the result as image 2.

    (c) Modify the hue H by changing the hue angle. Submit the image with increased hue (e.g. by 45 degrees) as image 3 and the one with decreased hue as image 4.

    (d) Modify all three parameters H, S, and I of the image to make it most beautiful! Submit the result as image 5.

    (e) Choose a gray level image and convert it into a psudo color image by assigning a color (in terms of the R, G, and B values) to each of the 256 gray levels through a color-lookup table, a 256 (for gray levels) by 3 (for R,G,B) array. You are free to choose the contents of the table for the color mapping. Submit the result as image 6.

Part II

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 (such as the in-house images ). 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. 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. The source code for 1D FFT, DFT and WHT is available at in-house C code ).
  1. Spatial Frequency Filtering with DFT

  2. Spatial frequency Filtering with DCT

    Use the 1D fast DCT function provided to implement your own DCT 2D filtering. 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 13.

    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 14 and 15.

  3. Spatial Sequency Filtering with WHT

    Now do the same for sequency filtering. Use the provided 1D fast WHT function to do 2D WHT filtering. Save the sequency spectrum as an image (after rescaling and normalization) and submit it as image 16.

    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 17 and 18.

  4. Spatial Sequency Filtering with discrete Haar transform (DHT)

    Repeat the previous part based on the DHT. Submit the results as images 19, 20, and 21.

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