### Project 4 - Image Restoration (100+20) (Due 10/14, extended to 10/17)

This project is to practice various geometric transformation, denoising and deblurring techniques we have studied. Three tasks are assigned:

• Task 1 - Denoising using both spatial domain filters (mean filters and order-statistic filters) and frequency domain filters (notch)
• spatial domain filters
• mean filters: arithmetic mean - amean(), geometric mean - gmean(), contraharmonic mean - contrah()
• order statistics filters: adaptive median - amedian()
• frequency domain filters
• notch filter - notch()
• Task 2 - Deblurring using frequency domain filters
• inverse filter - invFilter(), Wiener filter - wiener()
• Task 3 - Standard geometric transformation
• Affine transformation: scale, shear, rotate, translate
• Perspective transformation (572)

• Task 1: Denoising with mean filters and order-statistic filters.
• Task 1.1: Take the angiogram image and estimate the pdf of noise. Apply arithmatic mean, geometric mean, and median filter with appropriate kernel size. Apply Sobel edge detector on the original and the restored images and compare the results. Add the implementation of amean(), gmean() to spatialFilter.cpp
• Task 1.2: Take the wizardofoz image. Apply contraharmonic, median, and adaptive median to recover the impulse noise. Put contrah() and amedian() in spatialFilter.cpp
• Task 1.3: Take the Florida satellite image. Estimate its noise pattern. Try to remove the noise in both the spatial and the frequency domain. In the frequency domain, apply notch-reject filter to remove the noise. Add the implementation of notch filters in freqFilter.cpp b
• Task 2.1: Use Lena as the testing image. First blur it with a 3x3 Gaussian kernel. Then add SAP noise with probability equals to 0.25. The resulting image (g) will be used for testing purpose. First apply adaptive median to remove the noise. Then apply inverse filter and wiener filter to remove blur. Compare the results from inverse and wiener filter using both MSE and PSNR. Add the implementation of invFilter() and wiener() to deblur.cpp
• Task 2.2 (572 only): Restore the angiogram testing image. Keep in mind that you need to perform both denosing and deblurring with the appropriate estimate of blur and noise.
• Task 3: Study the fundamental transformations
• Task 3.1: Implement the four affine transformation functions (rotation, translation, shear, scaling) and perspective transformation (572 only) using the inverse transform. Write all five functions in one file and name it transform.cpp (this should go to the 'lib' directory)
• Task 3.2: Use the "clock" as testing image. Apply a composite transformation in the following sequence to test the functions implemented in 'transform.cpp'. Name this function 'testTransform.cpp'. Do this in two ways, sequential and composite.
• shrink by 2
• translation, to the center of the image
• shear, in the horizontal direction by 2
• rotation, clockwise by 30 degree
• perspective transformation (572 only)
• Bonus (+10/+10): Implement the adaptive local noise reduction filter and compare it with the adaptive median filter. Use Lena as the testing image. Add SAP noise with probability 0.1 and 0.25. Compare the result using PSNR.
• Bonus (+10/+10): Implement the geometric transformation using polynomial approximation. Use the image taken from space shuttle, space.pgm, for testing

#### What to turn in

• a tar file or a zip file with the following items:
• spatialFilter.cpp with added functions from amean(), gmean(), amedian(), contrah()
• freqFilter.cpp with added function from notch()
• deblur.cpp with functions from invFilter(), wiener()
• transform.cpp with four affine transformations and 1 perspective transformation
• testing codes
• Makefiles
• (3) Completeness of the above listed files
• a pdf file with the written report that includes the following
• (40 pt) Task 1 (in the following requirements, the comments take 30%, and the correctness of the implementation judged by the results and coding takes 70%)
• (2/2) Show the histogram you used to estimate the noise model in angiogram
• (10/10) Show results from amean, gmean, and median and comment on the results (which filter is more suitable for what kind of noise).
• (3/3) Show the edge images generated from both the noisy image and the restored image. Comment on the results.
• (15/15) Show results from contrah, median and amedian on the wizardofoz image. Comment on the result images. Again, which filter is more suitable for what kind of noise. Show results of applying contrah with Q being both negative and positive values.
• (10/10) Show the frequency response to Florida satellite. Show the noise image in the spatial domain. Also show the resulting image. Provide the parameters used in the notch filter.