Non-local mean denoising (Nl-means)

Source: Internet
Author: User

Non-local mean value (Nl-means) is a new denoising technique proposed in recent years. This method makes full use of the redundancy information in the image, and can keep the detail characteristics of the image to the maximum extent while denoising. The basic idea is that the estimated value of the current pixel is obtained by the weighted average of pixels in the image with similar neighborhood structure.

Theoretically, the algorithm needs to determine the similarity between pixels in the entire image range, that is, each pixel is processed to calculate the similarity between it and all pixels in the image. But given the efficiency issue, when implemented, two fixed-size windows are set: the Search window and the neighborhood window. The Neighborhood window slides in the search window and determines the pixel weights based on the similarity between the neighbors.

Is the Nl-means algorithm execution process, the large window is a target pixel-centric search window, two small gray windows are the center of the neighborhood window. It is assumed that the Center's Neighborhood window slides in the Search window, by calculating the similarity between the two neighborhood windows as the weighted value.

Nl-means Execution Process

The image with noise is set to the image after denoising. The grayscale value at the middle pixel point is obtained by the following method:

Where the weights represent the similarity between pixels and their values, the value is determined by the distance between the rectangular neighborhood and the center of the rectangle:

which

For normalized coefficients, for smoothing parameters, the attenuation degree of Gaussian function is controlled. The larger the Gaussian function, the higher the noise level, but also the more blurred the image. The smaller the edges, the more the edge detail remains, but the excess noise will remain. The specific value should be based on the noise level in the image.

Program:

Close all;clear All;clci=double(imread ('lena.tif')); I=i+ Ten*randn (Size (i)); TicO1=nlmeans (i,2,5,) tocimshow ([I,o1] ,[]);
function denoisedimg=Nlmeans (i,ds,ds,h)%I: Image with Noise%DS: Neighborhood window Radius%Ds: Search window Radius%h: Gaussian function Smoothing Parameters%denoisedimg: denoising image I=Double(I); [M,n]=size (I);D enoisedimg=zeros (m,n); Paddedimg= Padarray (I,[ds,ds],'symmetric','both'); kernel=ones (2*ds+1,2*ds+1); kernel=kernel./((2*ds+1)*(2*ds+1)); H2=h*h; forI=1: M forj=1: N i1=i+ds; J1=j+ds; W1=paddedimg (I1-DS:I1+DS,J1-DS:J1+DS);Neighborhood Window 1 Wmax=0; Average=0; Sweight=0; %%Search Window Rmin= Max (i1-ds,ds+1); Rmax= Min (i1+ds,m+DS); Smin= Max (j1-ds,ds+1); Smax= Min (j1+ds,n+DS);  forR=Rmin:rmax fors=Smin:smaxif(r==i1&&s==J1)Continue; End W2=paddedimg (R-DS:R+DS,S-DS:S+DS);Neighborhood Window 2 Dist2=sum (SUM (kernel.* (W1-W2). * (W1-W2)));distance between adjacent regions W=exp (-dist2/H2); if(w>Wmax) Wmax=W; End Sweight=sweight+W; Average=average+w*paddedimg (r,s); End End Average=average+wmax*paddedimg (I1,J1);Maximum weight value of sweight=sweight+Wmax; Denoisedimg (I,J)=average/Sweight; EndEnd

Results:

It can be seen that the nl-means noise effect is really good. But the biggest flaw of the algorithm is that the computational complexity is too high and the program is time-consuming, which makes the algorithm less practical. The Lena diagram of 256*256 in the example above is time consuming up to 33.913968s!!

To solve this problem, the application of Integral image (second): Non-local mean denoising (Nl-means) is used to accelerate the algorithm using integral image.

Non-local mean denoising (Nl-means)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.