Monday, October 5, 2009

Activity 19 Restoration of blurred image

Our final activity is again about image restoration. However unlike the previous activity, where we tackled images with additive noise, this time we will be restoring blurred images. Basically a blurred image is due to the effect of a degradation function to a given image. Let us also remember that in our earlier activities we have already encountered blurred images as a result of convolving apertures or filtering in the Fourier space. In this activity we will only be focused on blurred images caused by uniform linear motion with an additive gaussian noise.

Whatever the degradation process maybe, it can always be modeled as a convolution of the image and the degradation function such that in inverse space we obtained a blurred image given by
Equation 1

where H is the transfer function of the blurring process and N is the additive noise. For this activity we will be using the known degradation function of a uniform linear motion blur (equation 2). In equation 2, parameters a and b are the total displacements along x and y directions respectively and T is the total exposure time.

Equation 2

Just like in our previous activity the restoration process involves applying a filter or operation to obtain an estimate of the image from the degraded one. This time we will be using the Weiner (minimum mean square error) filter which incorporates both the degradation function and the statistics of the additive noise. The application of this filter operates in inverse space and is given by
Equation 3

where Sn and Sf are the power spectra of the noise and the ideal (undegraded) image. However, in real life situations it is highly improbable for us to have information on both the additive noise and the ideal (undegraded) image. For such cases equation 3 will be approximated into

Equation 4

where Sn/Sf is replaced by a constant K.

In this activity we use equations 1 and 2 on a gray scale image (figure 1) to produce a blurred image. Then we restore this blurred image using equation 3 or equation 4 with different values of K. We also do all of these for different gaussian noise strengths.

Figure 1

Figure 2. Blurred and restored image for different values of K, T, a, and b. We set the additive noise to be equal to zero

Figures 2 shows our results if we only have an image that is motioned blurred and no additive noise is present. From these images we clearly see that decreasing K improves the quality of our restoration. Furthermore, at the extreme case when K = 0 we arrive at a perfect restoration. These results are actually expected if we analyze equations 1 and 4. Doing simple math, at K = 0, equation 4 reduces to equation 5.
Equation 5
And since in this case we set the additive noise to zero, the last term in equation 5 vanishes and we are left with a perfect restoration.

(click to enlarge)
Figure 3. Blurred and restored image for different values of K, T, a, and b. Noise strength is sigma=0.001

In figure 3 we show the results of restoration when we consider the blurred image with an additive gaussian noise. Again similar to the case when there is no noise having a small value of K gives a very good quality of restoration. However, in this case if we further decrease K we then start to obtain dark noisy images. And, unlike the case of no noise, at K = 0 we obtain a meaningless restored image (almost pure noise).

One more notable result shown here is that even by using the exact power spectra of the noise and the original image, as in equation 3, we still do not obtain a perfect reconstruction. The restored image is indeed a significant improvement compared the blurred image but it is still not perfect.

I give myself a grade of 9 in this activity. The results we have obtained were very convincing but still left some questions unanswered. I would like to thank Master, Jaya, Orly, and Thirdy for helping me realize that I was wrong.


Main reference

A19 – Restoration of blurred image, AP186 2009



Activity 18 Noise models and basic image restoration

Just like any other measuring device or data gathering techniques noise is present in almost all forms of digital image acquisition. Noise, in general, is any unwanted aberration, random signal, or artifacts present in the image. Some of our previous activities already involved dealing with poor quality images using image enhancements. Previously we have used filtering in Fourier space, morphological operations, and even white balancing to improve the images. In this activity we will be using different image restoration methods to improve images with additive noise. In contrast to image enhancement, image restoration involves reversing the degradation process that produced the noise in the image. This means that a priori knowledge of the noise is important for a successful image restoration.

For this activity, we are tackling additive noise in the form of random variables following a specific probability distribution functions (PDF). We will be using six different noise models specifically: gaussian, rayleigh, gamma, exponential, uniform, and impulse noise.


Figure 1

There are many different types and methods of image restoration but in our case we will limit ourselves with spatial filters since they are most suited for additive noise. We will be using four types of filters namely, arithmetic, geometric, harmonic, and contraharmonic mean filters. With this filters we are basically changing the pixel values using the information provided by the image. All of this filters work by considering a subimage window centered at pixel(x,y) and using all the values within this window to calculate the new value of pixel(x,y) (figure 1). Equation 1 shows the formula followed by the arithmetic mean filter. This filter replaces the pixel value with the average of all the values in the window. On the other hand the geometric mean filter uses the product of all the values and takes its Ath root where A is the total area of the window (equation 2). The harmonic and contraharmonic mean filters follows equation 3 and 4 respectively.



Equation 1

Equation 2


Equation 3


Equation 4

In this activity we first create a noisy image by adding noise to a grayscale image then apply a restoration filter. We do this for each of the noise types and each of the restoration filters. Furthermore, to aide us in assessing our results we also take the histograms of all our images before and after restoration.

Figure 2 to 7 shows the result of applying the different restoration filters for each of the six noise types. It is clearly seen that even though the result is slightly more blurred it is actually much closer to the original image. This is further highlighted by looking at the image histograms. The histograms of the restored images are much closer that of the original image. The broadening or shifting introduced by the noise was greatly reduced by all the restoration filters. The minor blurring is simply due to the windowing; that is a smaller window results in less blurring but sacrifices the efficacy of the restoration. Here we used a 5x5 pixel window for a 256x256 pixel image.

Figure 2 Figure 3

Figure 4 Figure 5


Figure 6 Figure 7

However, looking at figure 7, we see that the restoration processes don't seem to negate the effect of the impulse (salt and pepper) noise. comparing the images we see very little to no improvement after implementing the arithmetic and geometric mean filters. Furthermore, looking at the histograms we even see that the restoration process degraded the image. The only semblance of improvement we can see is that the harmonic filtering and contraharmonic filtering with negative Q were both able to completely remove salt noise but not pepper. On the other hand using the contraharmonic filter with positive Q removes pepper noise but not salt.

We also did this whole procedure for a real grayscale image obtained from the internet (figure 8).

Figure 8
Overall this activity has been very enlightening and the results were very convincing. We were able to show that the different spatial filters are indeed useful for image restoration except for salt and pepper noise. I give myself a grade of 10 in this activity.

Main Reference:
AP186 "A18 – Noise models and basic image restoration", 2009