Monday, October 12, 2009

Activity 18 - Noise Models and Basic Image Restoration

Unwanted signals are hard to eliminate upon detection due to its random nature. In imaging, for every captured image, these unwanted signals in the form of noise do not take the same form in all the images, i.e., the noise detected at a pixel may no longer occur or may not have the same value for another image captured at the same pixel. It is important in image restoration to filter out these noise.
Modeling the noise added to an image is one way of analyzing the effect of noise, and in turn, for studying the use of different approaches to eliminate this noise. The randomness of noise is basis for the creating noise by generating images with probability distribution functions (PDFs) of the graylevels following the commonly random distributions: Erlang (Gamma), Exponential, Gaussian (Normal), Rayleigh, Salt and Pepper (Impulse), and Uniform.
Removing noise from images requires some filtering methods, whether in real or inverse space. In this activity, filtering is done in the real space using different methods. The filters tackled here mainly uses a window over which several (statistical) operations are carried out on the image with the effect of changing the grayvalue of a pixel in which the center of the window is located. The operations describe the filters used, namely, the arithmetic mean filter, geometric mean filter, harmonic mean filter, and contraharmonic mean filter. The main objective is to observe the effectivity of noise filtering using different filters and parameters used, such as the size of the window.
First, the noise models were added to the sample image shown below. The original PDF of the image contains three spikes at the grayvalues of the 3 regions, the black background, the gray square, and the near white circle. Adding the noise effectively broadens these spikes such that they overlap. The contrast of the images are degraded as seen visually upon the addition of noise. Using the different filters, the image is restored. In comparing the different filters, the original noisy image is compared with the restored images using arithmetic mean, geometric mean and harmonic mean filters, and then with the contraharmonic mean filter using different values of the parameter Q. The corresponding histogram of the images are shown after each set of images.
Original image
Window size: 5x5

Erlang (Gamma)


Exponential

Gaussian (Normal)

Rayleigh
Salt and Pepper (Impulse)

Uniform

The different image restoration results that were observed showed that indeed, the image is improved especially in the contrast, as compared to the noisy image. In the histogram, the broadening of the three peaks brought about by the added noise was minimized such that histogram of the three regions no longer overlap to some extent. Interestingly, the histogram for each region upon restoration appears in a Gaussian distribution (except for impulse noise).
The results for impulse noise using the contraharmonic filter verify the effect of the parameter Q. Indeed, the positive Q values remove pepper noise but results to enhancing the salt noise. On the other hand, negative Q values remove salt but not pepper noise. For the occurrence of both, it is ideal to used Q=0.
Using other filters depend on the noise (type, strength, etc.) added on the image. Depending on the use of the image or whether a person is satisfied with the result, the right filter (with proper parameters) can be determined, whether visually, or in the histogram.
The window size chosen here is 5x5, which translates to operations over a 5x5 pixel array. As seen in the results, the separation between the regions is no longer defined. It appears smeared due to the operation over a large pixel array. This would also translate to details becoming blurred or may even be totally removed due to the smearing. In such cases, it is better to use smaller window sizes to retain the information. However, there is a tradeoff because larger window sizes would provide better noise filtering, since statistics is based on more values. Again, this translates to adjusting the parameters depending on the purpose of use of the restored images. This may also be helpful whether details of the image are directional, for example, if outlines in the image are along the horizontal, then a 5x3 window size can be used, to filter noise well without affecting the details of the image.

Original image
For the next set of images, a grayscale image of Lotus (shown above) was added with noise. Since this has more details compared to the previous image used, a smaller window size (3x3) is used. The PDFs of the noise image do not have a significant region of separation so it is interesting to see how much improvement can be obtained.

Erlang (Gamma)
Exponential

Gaussian (Normal)

Rayleigh

Salt and Pepper (Impulse)
Uniform

Image restoration for this set of images was clearly obtained. The histogram of the images were "stretched" such that the contrast as seen visually are improved. This demonstrates that the method for noise filtering is effective. The same effect of positive and negative Q values for the contraharmonic filter were also observed in the impulse noise. It can also be observed that the harmonic mean filter is a very flexible technique (applicable for all noise distributions) and is very reliable in restoring the image.
For this activity, I would like to give myself a grade of 10 for successfully creating and adding the noise models and implementing the different noise filters.
I would like to thank Jay Samuel Combinido, Mark Jayson Villangca, and Miguel Sison for their help in this activity, and also for the guidance of our professor, Dr. Gay Jane Perez.

1 comment: