[Filtering·3] NLM non-local mean denoising

Official website: IPOL Journal · Non-Local Means Denoising

1.Basic idea

Non-Local means is a denoising technology proposed in 2011. This method makes full use of the redundant information in the image and can maintain the detailed features of the image to the greatest extent while removing noise. The basic idea is: the estimated value of the current pixel is obtained by the weighted average of pixels in the image that have a similar neighborhood structure to it (the more similar the value, the higher the weight).

2. Specific implementation

Theoretically, this algorithm needs to determine the similarity between pixels within the entire image range. That is to say, every time a pixel is processed, the similarity between it and all pixels in the image must be calculated. However, considering efficiency issues, two fixed-size windows will be set during implementation: search window and neighborhood window . The neighborhood window slides in the search window and the weight of the pixel is determined based on the similarity between neighborhoods.

The figure below shows the execution process of the NL-means algorithm. The large window is the search window centered on the target pixel, and the two small gray windows are neighborhood windows centered on . The centered neighborhood window slides in the search window, and a weight w(x,y) is assigned by calculating the similarity between the two neighborhood windows.

        Assume that the image containing noise is , and the image after denoising is . The gray value at the middle pixel is obtained as follows:

Tips

(1) There is a d square in the above formula, which is sometimes omitted when implementing the code . This is because d-squared is a definite value, which can be considered as integrated into h-squared. This saves a lot of division when implementing the code.

(2) There are some differences between the above formula and the original text:

The square of this distance is equivalent to that . He calculated the distance of three channels. I think it is unnecessary. Calculating a single channel already takes up too much computing resources. 

 

(3) Another formula difference:

 He added a threshold to the distance. When the distance is less than that , the pixel is considered to have a great contribution to x, which is considered to be 1. When it is greater than the distance, the weight decreases rapidly, and its contribution to x is considered to be low.

Z(x) is the normalization coefficient, h is the smoothing parameter, which controls the attenuation degree of the Gaussian function. The larger h is, the smoother the Gaussian function changes and the higher the denoising level, but it will also make the image blurr. The smaller h is, the more edge detail components are maintained, but too many noise points will remain. The specific value of h should be based on the noise level in the image.

result:

reference

Non-local mean denoising (NL-means)_Jusha Tower's Blog-CSDN Blog

Application of integral images (2): Non-local mean denoising (NL-means)_fastnlmeans and nlmens_Jusha Tower's Blog-CSDN Blog

Guess you like

Origin blog.csdn.net/u013066730/article/details/132085811