Thursday, October 1, 2009

Activity 19 - Restoration of blurred image

In this activity, the objective is to demonstrate restoration of an image corrupted with a known degradation function (in this case, motion blur) and additive noise. [1]

A grayscale image containing text was copied from the web and corrupted by applying motion blur and noise, following the equation:
where f(x,y) is the original image, h(x,y) is the blurring (degradation) function, n(x,y) is the added noise. Or in Fourier space, the corrupted image is given by:

where G,H,F, and N are the Fourier transforms of the corresponding terms in the previous equation [1].

The degradation function is modeled by the equation:

where a and b are the total distance for which the image has been displaced in the x- and y-direction and T is the total time of displacement [1].

The image is restored by Weiner filtering or minimum mean square error filtering or least square error filtering by applying the following equation, which gives the frequency-domain estimate of the restored image:
where:
H(u,v) is the degradation or blurring function
|H(u,v)|^2 = H(u,v)* H(u,v)
Sn(u,v) = |N(u,v)|^2 (power spectrum of the noise)
Sf(u,v)| = |F(u,v)|^2 (power spectrum of original image)

Most of the time, the power spectrum of the original image is unknown, in which case we apply the other form of the Weiner filter given by:
where K is a specified constant.

The original image (left of the divider) is blurred by applying the degradation function (where a=b=0.1 and T was varied) and Gaussian noise was added. The restored images are shown below (right side of divider).

Original image | T=1, T=2, T=3.

All the images above are restored assuming the power spectrum of the undegraded image is known. We can see that as long as the power spectrum of the original image is known, the image can be restored quite well no matter how the image was degraded.

Now we look at the effects of varying a and b to the restoration. Shown below are the restored images blurred with varying a and b.
Original image | a=b=0.01, 0.03, 0.05, 0.07, 0.09

We can see that varying a and b has minimal effect on the restoration, as long as the power spectrum of the undegraded image is known.

What if we do not know the power spectrum of the original image? We try to predict the value for K. Shown below are the restored images using different values of K.

Original image | (top row) K = 1, 0.1, 0.01 (bottom row) K = 0.001, 0.0001, 0.00001

Restoring the corrupted image without knowledge of the power spectrum of the original image proved to be more difficult. Different K values were tried out, and it was observed that starting from K=0.001 below, the image is restored quite well. But for values greater than K=0.001, the restored image is still blurred.

Problems encountered:
I, as well as other classmates, had trouble displaying the blurred image. The resulting image which was supposedly corrupted with motion blur did not display the expected blurred image with streaks but instead showed a superposition of the "initial and final frames" of the supposedly blurred image. However, the information contained in the array in the program seems correct, because reconstruction was done successfully. The problem is just in displaying the blurred image.

I give myself 9 points for this activity. I would like to thank Thirdy Buno for useful discussions.



References:
[1] A19 - Restoration of blurred image - Dr. Maricor Soriano

Activity 18 - Noise Models and Basic Image Restoration

In this activity, we investigate how different noise reduction filters restore images with different kinds of added noise:

Noise models: Gaussian, Rayleigh, Gamma, Exponential, Uniform, and Impulse (or salt-and-pepper) Noise
Noise filters: Arithmetic Mean, Geometric Mean, Harmonic Mean, Contra-harmonic Mean

We used each of the above noise models in conjunction with each of the noise filters. Below are the results:


The arithmetic mean filter gave the cleanest restoration for all the noise models. The harmonic mean filter comes close, except for the salt and pepper noise. The harmonic mean is also better than arithmetic mean for the Gaussian noise. The geometric mean filter was the least effective filter. Except for the gamma noise, the geom mean filter converted the gray pixels to black.

I give myself 10 points for this activity. I was able to perform noise addition for different noise models, and restore the images using different noise filters.

Thanks to Kaye and Miguel for help in some of the noise models.