Monday, October 12, 2009

A19 Restoration of Blurred Image

--- brown out bakit mo binura files ko.

In the previous activity, we restored images that have additive noise.
Now we add another kind of degradation which is the motion blur.

The degradation/restoration process can be described by the following model.

Degradation can be represented as a function (H) that acts on an image f(x,y) and together with an additive noise, transforms it to a degraded image g(x, y). The goal is then to generate restoration filters that will transform the degraded image to an estimate of the original image f_hat(x,y).

In the spatial domain, the degradation process is a convolution with the image.

Therefore in the frequency domain it can be written as
MOTION BLUR

Suppose that this degradation is due to the uniform linear motion between the image and the sensor or camera. Then the camera would have captured the image motion in the duration of the exposure time T.
The blurred image can be expressed in Fourier space as
The degradation transfer function would then be computed using
where a and b is the total distance for which the image has been
displaced in the x- and y-direction, respectively. (Note: xo(t) = at/T and
yo(t) = bt/T)

WEINER FILTERING

This method considers images and noise as random processes and tries to minimize the MSE between orignal f and restored f_hat images using the following expression known as the Weiner filter

where
Assuming that the noise is just white noise and therefore constant, we have

Now for the application of the concepts....

For our original image we use

http://imageedit.infobind.com/examples/grayscale.jpg

Next we degrade the original image by blurring (transfer function given by Eq5) and adding Gaussian noise (Activity 18). We can get the degraded image using Eq2.

The parameters a, b, and T will determine the velocity of the motion in the x and y direction: vx=a/T and vy=b/T. Of course, increasing the velocities would just make the image more blurry as shown in the following images.

Doing the restoration using the actual noise pdf ( eqn 6 ), we get the following results.
Of course, the more blurred an image is, the less perfect the restoration. However we note that even for a=b=0.1 blurring, when image is no longer recognizable, filtering was still able to salvage some of the lost data.


Now we compare the results when we just assume white noise (Eq 7). As expected. better results were obtained when we did not assume white noise. K=0 results to almost all noise images. The filtering improved when K=0.001 and increasing K further does not seem to result to better restorations.


In this activity, I was able to do reconstructions of very blurry images so I give myself a grade of 10.


A18 Noise Models and Basic Image Restoration

In this activity, we attempt to reconstruct or recover an image that has been degraded by using an a priori knowledge of the degradation phenomenon.

For the degradation process, we generate noise signals with different probability distribution functions and added them to the image. In actual image capture, noise could be caused by light levels, fluctuating temperatures, atmospheric disturbances and other factors.

The noises that we generated are those that are common in image processing applications and are given by the following formulas.








To remove additive noise, we implemented the spatial filtering method.

The filters that we used are



Below is our original image and its histogram.


Adding noise to the image changes this image histogram.

Gaussian Noise

Rayleigh Noise

Erlang (Gamma) Noise

Exponential Noise

Uniform Noise

Salt and Pepper Noise




For each noise pdf, we try to reconstruct the original image using the different filters. Our goal is to recover the appearance of the original image. A way of checking this is by comparing the reconstructed image's pdf with the original pdf. The images below show the reconstructions with their pdf.

Gaussian Noise


Rayleigh Noise

Erlang (Gamma) Noise

Exponential Noise

Uniform Noise
For the first 5 noise pdfs, all four filters were successful in reconstructing the image.
We can see, however, that only Arithmetic and Contraharmonic filters work for salt and pepper noise.

Salt and Pepper Noise with Q=0


Varying Q, we can see that negative values only clean salt noise, while positive values only clean pepper noise. Q=0 cleans both but not completely.
We do the same for another image, this time one that has a broader range of grayscale values.

Original Image


After adding noise:

Gaussian Noise

Rayleigh Noise

Erlang (Gamma) Noise

Exponential Noise

Uniform Noise

Salt and Pepper Noise



After reconstruction

Gaussian Noise

Rayleigh Noise

Erlang (Gamma) Noise

Exponential Noise

Uniform Noise

Salt and Pepper Noise w Q=0


Varying Q, we get the same effect as our first image.

In this activity, I was able to do spatial filtering to remove noise from an image. I therefore give myself a grade of 10.