CSCE 5683 - Homework 4
Due Date - 11/12/2012 at 11:59 PM

1. Problem Statement:

The goal of this assignment is to gain experience with image restoration. To do this, you will be running a series of experiments creating distorted images, and then restoring them using inverse filters. There is no programming required, but you may want to write some csh/bash scripts to save typing.

2. Creating Distorted Images:

The most common distortion is blurring. In order to do this, you must compile the "menu" application in the src/code directory. You can perform blurring two ways: (1) by calling "menu convolve mask.txt input.jpg output.jpg", (2) by calling "menu filter mask.txt input.jpg output.jpg". The first does convolution in the spatial domain. The second performs the same operation in the frequency domain.

The convolution mask is specified in an ascii file in portable greymap file (PGM) format. The first line of the file is a header starting with "P2" (to indicate PGM format) followed by the X dimension, the Y dimension, and the maximum pixel value. The remaining lines contain pixel values in rows. For example, here is the 3x3 Binomial mask:

P2 3 3 4
1 2 1
2 4 2
1 2 1

Before you start creating blurred images, make sure your input image has "power of two" dimensions (eg 256x256 or 512x512). This will speed up the FFTs. You can do this using the command "menu interpolate 256 256 input.jpg output.jpg".

Now use the "menu convolve" command to create three blurred images with your mask files. Time the execution of these convolutions using the Linux "time" command. How much does the time increase as you increase the size of the mask?

Now use the "menu filter" command to create three blurred images with your mask files. Time the execution of these convolutions using the Linux "time" command. How much does the time increase as you increase the size of the mask?

Finally, compare the output from "menu convolve" and "menu filter". Do they look the same, or can you see differences?

3. Restoring Images:

The most basic image restoration approach is inverse filtering. The "menu inverse_filter mask.txt #min input.jpg output.jpg" command performs inverse filtering using the mask.txt file to define the blurring function. The parameter "#min" is used as a "clamp" on the inverse filter. All filter values less than min will be set to min before division takes place. This avoids potential division by zero, and lets us selectively tune the inverse filter.

Using the three blurred images from above, run a series of inverse filtering experiments with a range of "#min" values to see what restoration you can accomplish. Save one image where min is too small, one where min is too large, and one where min is just right. Do this for all three blurring masks, and save your output images in your report.

4. Smoothing Restored Images:

Some of your restored images may look like they have high frequency noise added to them. Try a few experiments using "menu median #nxdim #nydim input.jpg output.jpg" and with "menu gauss_lp #freq input.jpg output.jpg" with a range of parameter values to see if smoothing can make the restored image look more like the original image. If so, save a few of these images for your report.

5. Documentation:

When you have completed your experiments write a short report describing what the objectives were, what you did, and your findings. Include copies of your mask.txt files, and a variety of images to show how your image restoration worked. Save this report in a word/pdf file to be submitted electronically.

6. Project Submission:

In this class, we will be using electronic project submission to make sure that all students hand their programming projects and labs on time, and to perform automatic analysis of all programs that are submitted. When you have completed the tasks above go to the class web site to "submit" your documentation, C++ program, and testing files.

The dates on your electronic submission will be used to verify that you met the due date above. All late projects will receive reduced credit (50% off if less than 24 hours late, no credit if more than 24 hours late), so hand in your best effort on the due date.

You should also PRINT a copy of these files and hand them into your teaching assistant in your next lab. Include a title page which has your name and uaid, and attach your hand written design notes from above.