You are on page 1of 4

Digital Image Processing

Spring 2015 - Amirkabir University

Assignment #4
Image Restoration

How TA evaluates your assignments:


Report: half of your score will be graded proportional to the quality of your report. You should provide
a distinct section for each problem, include the desired outputs and explain what youve done.
Dont forget to discuss your results as well. Note that in your reports, all your figures must have
captions. It is not necessary to accommodate your source codes in your reports unless you want to
refer to them. Compactness, expressiveness and neatness are of high importance.
Source Code: create an m-file for any problem and write all your codes there. If a problem consists
of several sub-problems, separate them by comments in your code. Finally, name your m-files
according to the number of the problems.
For evaluating your codes, TA creates two empty folders just beside your m-files, named as input
and output (in the same directory). Then, he copies the input materials into the input folder and
executes your m-files. Next, the output files will be checked in the output folder. Therefore, write
your codes so as to load input files from an input folder and save the output files in an output
folder. The exact name of the input and output files will be provided in the problem descriptions.
What to hand in:
You must submit your report (.pdf), source codes (m-files) and output files for each assignment. Zip
all your files into an archive file and use the following template to name it:
HW4_XXXXX.zip
where XXXXX must be replaced with your student ID. Your file size must not be bigger than 20MB. If
there is any question, dont hesitate to contact me through s.izadi@live.com
The Due Date for This Assignment is: May 26th

1. Load the image BWCheckboard.bmp and corrupt it by the following types of noises. Show the
histogram of the noisy images and analyze their forms. What do you see? Explain your observations and
include the results in your report.
Salt and Pepper

Uniform

Gaussian

Rayleigh

Gamma

Exponential

Note: You are not allowed to use imnoise function in MATLAB, instead you may find random function
helpful. All values should be in the range of [0,1].

Figure 1. Image corrupted by Exponential noise and its corresponding histogram

Digital Image Processing

Spring 2015 - Amirkabir University

2. The white bars in the image WBars.tif are 7 pixels wide and 210 pixels high. The separation between
bars is 17 pixels. What would this image look like after application of:
a) A arithmetic mean filter

e) A contraharmonic mean filter with Q=-1.5

b) A geometric filter

f) A median filter

c) A harmonic mean filter

g) A max filter

d) A contraharmonic mean filter with Q=1.5

h) A midpoint filter

Note: Use 3x3, 5x5 and 9x9 windows for each filter. This problem may seem a bit tedious. However, they
are worth the effort, as they help develop a real understanding of how these filters work. After you
understand how a particular filter affects the image, your answer can be a brief verbal description of the
result. For example, the resulting image will consist of vertical bars 3 pixels wide and 206 pixels high. Be
sure to describe any information of the bars, such as rounded corners. You may ignore image border
effects, in which the masks only partially contain image pixels.

Figure 2. White bars

3. Implement the following frequency filters in MATLAB. Verify your implemented codes on the two images
Boy.bmp and Lena.bmp and include the results for different parameters in your report. Set the
parameters to get the best resultant images and present them separately in your report. Investigate the
qualitative performance of all filters and precisely compare them.
Band-Reject

Ideal

Gaussian

Butterworth

Notch-Reject

Ideal

Gaussian

Butterworth

In addition, apply the following filters to isolate the noise patterns and examine further their types. Include
the results for different parameters in your report. Examine the qualitative performance of all filters and
precisely compare them.
Band-Pass

Ideal

Gaussian

Butterworth

Notch-Pass

Ideal

Gaussian

Butterworth

Figure 3. Images corrupted with periodic noise

Digital Image Processing

Spring 2015 - Amirkabir University

4. Load the image board.bmp and degrade (blur) it by the following matrix (you can use imfilter for
doing so):
m 0.1429 0.1429 0.1429 0.1429 0.1429 0.1429 0.1429

After doing so, the resultant image will become similar to the Fig. 4 (right).

Figure 4. Board and degraded board with blurness

a. Deblur the image using Inverse Filtering, which is simply dividing the image transform by the
transform corresponding to the blur filter. Name the resultant image as Board_inv.bmp and write it.
What do you observe? Why the resultant image is not good?
b. The solution to the problem that you faced above is to constrain the division by dividing only by
values that are above a certain threshold (constrained division). Perform the task above with this
consideration and name the best resultant image as Board_inv_cd.bmp and write it. Does this
modification make the result better? Include the results for different values of threshold in your report.
c. (Optional-Extra Credit) Degrade the same input image with the following filter and try to restore
the image through inverse filtering with constrained division. Include the results in your report.

0
0.0268 0.1268 0.1464
0

m 0
0.1
0.2
0.1
0
0.1461 0.1268 0.0268
0
0
5. Load the image aerial.bmp and do the following task:
a. Degrade the image to produce the severe, mild and low atmospheric turbulence degradations.
Name the resultant images as aerial_severe.bmp, aerial_mild.bmp and aerial_low.bmp
respectively and write them into the output directory.
b. Attempt to restore the degraded images using inverse filters. Use a Butterworth model for the cutoff in order to minimize spatial ringing. Include the results for several radii in your report and set the
parameters to get the satisfying result. Name the best restored image as aerial_turb_restor_inv.bmp
and write it into output directory. Explain your observations.
c. In addition to atmospheric turbulence, corrupt the image with some Gaussian noise. Attempt to
restore the degraded images using Wiener filters. Include the results for different values of parameters
in your report. Set the parameters to get the best result and save it as aerial_turb_restor_wien.bmp.
Explain your observations.
d. Load the image cover.bmp and degrade the image to produce a set of linear motion blurred
images. Examine the effect of parameters a and b on the results. Include the results in your report.

Figure 5.

Digital Image Processing

Spring 2015 - Amirkabir University

6. It is possible to remove certain objects from an image while maintaining the structure and texture of it.
We called it as inpainting problem. Load the image horseText.bmp. As you see a lot of nonsense texts
are covering the image. You can use the image mask.png to have the pixels position of the text. Use
the interpolation methods; nearest neighbor, bilinear and bicubic to recover the image and remove the
texts. Working with RGB image (each channel separately) is of high interest, but you can work with gray
level version as well. Using MATLAB built-in functions is possible . Name your resultant images as
horseText_NN.bmp, horseText_BL.bmp, and horseText_BC.bmp respectively and write them into the
output directory.

Figure 6. Corrupted image and its mask

7 (Optional-Extra Credit). Read the following paper and summarize it in at most two pages. Include the
pipeline of the algorithm and its contributions in your summary. Intuitive analysis of the method and
reflecting its cons and pros are of high interest. Implement the introduced paper and verify your code
on an arbitrary noisy image. Name the resultant images as P7_output_1.bmp to P7_output_K.bmp (K
is the number of noisy images) and write them into the output directory. Include the noisy images that
you have used in your submission as well.
Garnett, Roman, et al. "A universal noise removal algorithm with an impulse detector."
Image Processing, IEEE Transactions on 14.11 (2005): 1747-1754.APA

Good Luck,
Saeed Izadi

You might also like