You are on page 1of 4

Image Denoising with the Non-local Means Algorithm

Avindra Fernando University of Kansas December 2010


avindra@ku.edu

Abstract
At present there are a variety of methods to remove noise from digital images, such as Gaussian filtering, Wiener filtering etc. Due to certain assumptions made about the frequency content of the image, many of these algorithms remove fine details from images in addition to the noise. The non-local means algorithm assumes the concept of self-similarity, instead of making the above mentioned assumptions. This concept of self-similarity is used in the NLM algorithm to perform image denoising. This project will implement the non-local means algorithm and compare it to two other denoising methods, Gaussian filtering and Wiener filtering.

filtering. Finally, in section 6, I will discuss the future work and optimizations that could be done to improve this approach.

2. Related Work
There are two assumptions made by most denosing algorithms about the noisy image [2]. This could result in blurring and loss of fine detail in the denoised image. The first assumption is that the noisy image comprises of both low and high frequencies. The noise can be classified as non-smooth because of the high frequencies contained in it. The second assumption is that the original image only contains low frequencies. i.e. images do not contain fine detail. The Gaussian and the Wiener approaches also make these assumptions [2]. They attempt to denoise the noisy image by removing the higher frequencies from the lower frequencies. However, some images may not be smooth. They can contain fine details and structures which have high frequencies. Because these methods cannot differentiate between the higher frequencies of the original image and the noise, the high frequencies of the original image will be lost. This results in blurring. In addition, the low frequencies of the noise will still remain in the denoised image. To prevent this from happening, Buades[1] suggested a better approach. The non-local means approach does not make the two assumptions mentioned previously. Instead it assumes that the image contains an extensive amount of self-similarity.

1. Introduction
Image denoising is one of the most important concepts in computer vision. It is widely used in various imagerelated applications, MRI analysis, 3-D object detection etc. Most digital images contain some degree of noise. The goal of image denoising is to to restore the details of an image by removing unwanted noise. Theoretically, the denoised image should not contain any form of noise. Over the years, many denoisng approaches have been proposed. Some of the major denosing methods include Gaussian filtering and Wiener filtering etc. However, most of these methods tend to lose fine detail of the image which leads to blurring. In this paper, a non-local means approach is presented, which performs image denoisng while preserving most of the fine detail of the noisy image. This method will then be compared with two other denoising methods using different criteria on the denoised images. As suggested by Buades [1], method noise, which is the difference between the image and the denoised image, will be used as one of the criteria. Section 2 provides a brief background on the previous methods used and introduces the new non local means approach. Section 3 gives a discrete explanation of the NL-means algorithm. In section 4 the test results of this approach and two existing approaches are given. Section 5 shows the advantages of the NLM approach by comparing its performance against Gaussian filtering and Wiener

Figure 1: Example of self-similarity in an image. Pixels p and q1 have similar neighborhoods, but pixels p and q2 do not have similar neighborhoods. Because of this, pixel q1 will have a stronger influence on the denoised value of p than q2[2].

Figure 2: From left to right: original image, noisy image (sigma = 10).

3. Non-local Means
The Self-Similarity concept was originally developed by Efros and Leung for texture synthesis [4]. The NLM method proposed by Buades[1] is based on the same concept. This concept is better explained through an example given in figure 1. The figure shows three pixels p,q1, and q2 and their respective neighborhoods. It can be seen that the neighborhoods of pixels p and q1 are much more similar than the neighborhoods of pixels p and q2. In fact, to the naked eye the neighborhoods of pixels p and q2 do not seem to be similar at all. In an image adjacent pixels are most likely to have similar neighborhoods. But, if there is a structure in the image, non-adjacent pixels will also have similar neighborhoods. figure 1 illustrates this idea clearly. Most of the pixels in the same column as p will have similar neighborhoods to ps neighborhood. In the NLM method, the denoised value of a pixel is determined by pixels with similar neighborhoods.

NLM algorithm should not alter any non-noisy images the method noise should be very small when the algorithm is performed on non-noisy images. However, good quality images also contain a certain degree of noise. Therefore, it makes sense to evaluate any denosing method using method noise [1].

3.2. Non-Local Means Method


In the non-local means denoised image, each pixel i is computed as follows[1]:

3.1. Method Noise


Figure 2 shows an example of a noisy image with sigma 10. As mentioned in section 2, most denoising methods degrade or remove fine detail and texture of the original image. In order to better understand this removal, Buades introduced method noise, as a tool to analyze the accuracy of his algorithm [1]. Method noise can be defined as follows. where u is an image, and Dh is the denoising operator depending on a filtering parameter h [1]. In other words, method noise is the difference between the original image u and its denoised version. Since the application of the

where V is the noisy image, and weights , which depend on the similarity between the pixels i and j , satisfy the following conditions and . Each pixel is a weighted average of all the pixels in the image. The similarity between two pixels i and j depends on the similarity between neighborhoods of pixels i and j[1]. Let Ni denote a square neighborhood of fixed size and centered about a pixel i. We can measure the similarity between two neighborhoods using the weighted sum squared difference between the two neighborhoods. This can be done using the following formula [1]:

where a is the neighborhood filter applied to the weighted sum squared difference. The weights can then be computed using [1]

Figure 3: MSE comparisons for Peppers256 image.

where Z(i) is the normalizing constant defined as[1]

5. Conclusion
h acts as a degree of filtering. After the analysis of the test results the non-local means algorithm proved to be a better algorithm for image denosing, than its predecessors. The Gaussian filtering performed poorly on all the test cases. The denoised images still contained significant amount of noise. The method noise of this approach had the fine detail of the original image in it. The Wiener filter managed to perform a little better than the Gaussian filter. However, the denoised images still appeared to be blurry. The non-local means approach had the best performance out of the three methods. It was able to recover much more detail of the original image from the noisy image. It was able to identify fine texture details such as the stripes in the babara image. After analyzing the MSE of the test cases, it is clear that the NLM method also performed well on the boat image and the peppers256 image. Due to its ability to remove noise while preserving great detail, the NLM method is a highly successful way of approaching image denosing.

4. Experimental Results and Discussion


The non-local means method was tested on several images with added Gaussian white noise. The neighborhood size was set to be 7, and the similarity window size was set to be 3, in all the test cases to obtain the optimal results. This method in general rendered positive results. Gaussian and Wiener filtering methods were compared to the non-local means method using three different criteria. 1) Visual quality comparison, 2) mean square error (MSE) comparison, and 3) method noise comparison [2]. When compared visually, the denoised images obtained using the non-local means method were clear and did not seem to contain any noise. The MSE of these images were significantly lower. Table 1 compares the MSE for different standard deviation of the added noise between the three methods. The method noise of NLM method was very similar to white noise. The comparison of the denosing results of the non-local means method vs. Gaussian and Wiener filtering is shown in figure 3. Image Boat Peppers256 Gaussian 10.6949 12.2628 Wiener 10.0759 9.7400 NLM 8.7463 8.0115

6. Future Work
There are numerous things I would like to improve with this work. First, the code could be optimized to yield faster computation. Although, this algorithm performs quite well, the computational complexity is of order O (n4) [3]. Even for a 512x512 size image, it takes about 134 seconds. This is highly impractical. An approach using Summed Image (I) concept has been introduced by Karnati[3], which is supposed to be 80 times faster than the original Buades algorithm. The Buades non-local means algorithm was implemented using Matlab. The computational complexity can also be reduced by implementing the algorithm using C++ or Mex.

Table 1. Mean square error table. A smaller mean square error indicates that the estimate is closer to the original image.

Second, the code could be optimized to improve performance. The current implementation performs well when compared to its predecessors. However, it still is unable to remove some noise. The method noise of the NLM method also seems to contain some detail of the original image. Also its ability to perform on color image is not up to the expectations of todays scientists.

References
[1] A. Buades, B. Coll, and J Morel. A non-local algorithm for image denoising. IEEE International Conference on Computer Vision and Pattern Recognition, 2005. [2] W.Evans. Image Denoising with the Non-local Means Algorithm. Technical Report,2005.. [3] V. Karnati, M. Uliyar, and S. Dey, Fast non-local algorithm for image denoising, in Proc. of IEEE ICIP, Cairo, Egypt, 2009.. [4] A. Efros and T. Leung. Texture synthesis by nonparametric sampling. In Proc. Int. Conf. Computer Vision, volume 2, pages 1033-1038, 1999. [5] Mathworks. The Matlab image processing toolbox. http://www.mathworks.com/access/helpdesk/help/toolbox/i mages/ [6] H. Manjon Herrera, A Buades. Matlab Central Non-Local Means filter. http://www.mathworks.com/matlabcentral/fileexchange/131 76 .

You might also like