File Exchange

image thumbnail

Noise Level Estimation from a Single Image

version 1.8.0.0 (138 KB) by Masayuki Tanaka
It can precisely estimate noise level from a single image.

33 Downloads

Updated 03 Feb 2015

View Version History

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

NoiseLevel estimates noise level of input single noisy image.
[nlevel th num] = NoiseLevel(img,patchsize,decim,conf,itr)
Output parameters
nlevel: estimated noise levels.
th: threshold to extract weak texture patches at the last iteration.
num: number of extracted weak texture patches at the last iteration.

The dimension output parameters is same to channels of the input image.
Input parameters
img: input single image
patchsize (optional): patch size (default: 7)
decim (optional): decimation factor. If you put large number, the calculation will be accelerated. (default: 0)
conf (optional): confidence interval to determin the threshold for the weak texture. In this algorithm, this value is usually set the value very close to one. (default: 0.99)
itr (optional): number of iteration. (default: 3)

Example:
img = double(imread('img.png'));
nlevel = NoiseLevel(img);

Web page:
http://bit.ly/NLest (http://www.ok.ctrl.titech.ac.jp/res/NLE/noise_level.html)

Reference:
Xinhao Liu, Masayuki Tanaka and Masatoshi Okutomi
Noise Level Estimation Using Weak Textured Patches of a Single Noisy Image
IEEE International Conference on Image Processing (ICIP), 2012.

Xinhao Liu, Masayuki Tanaka and Masatoshi Okutomi,
Single-image Noise Level Estimation for Blind Denoising,
IEEE Transactions on Image Processing, Vol.22, No.12, pp.5226-5237, 2013.

Cite As

Masayuki Tanaka (2021). Noise Level Estimation from a Single Image (https://www.mathworks.com/matlabcentral/fileexchange/36921-noise-level-estimation-from-a-single-image), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (27)

John Volpert

I changed line 78 in the Noise function to
tau0 = gammaincinv(conf,double(r)/2,'upper')/ 2.0 / Dtr * double(r);
from
tau0=gaminv(conf,double(r)/2, 2.0 * Dtr / double(r));
Now you don't need the stats toolbox

Maaria Rantala

This function requires also Statistics and Machine Learning Toolbox.

Masayuki Tanaka

Hi enji istanbouli,

I guess you have run demo.m in the tool box.
Please check the demo.m file.

True is the setting noise level. R, G, and B are noise levels for each channel.

Thanks,

enji istanbouli

Hello
I tried this function and thats the result that I got :

True: 5.00 R: 5.00 G: 5.06 B: 5.09
Calculation time: 2.12 [sec]

True: 10.00 R: 9.68 G: 9.75 B: 9.99
Calculation time: 0.57 [sec]

True: 20.00 R:19.56 G:19.60 B:19.67
Calculation time: 0.60 [sec]

True: 40.00 R:39.16 G:39.08 B:39.43
Calculation time: 0.61 [sec]

Can someone please explain to me what those numbers means and how to use them to evaluate noise

Masayuki Tanaka

Hi Sndn_Shr,
The output noise level is the standard deviation.
Thanks,

Sndn_Shr

Is the output noise variance or standard deviation?

Stefan Haninger

Woo-Jin Cho Kim

Dear Dr.Tanaka,

The noise level accuracy depends on the number of weak patches used. So what percentage of ALL patches would you consider to be enough for an accurate estimate?

Thank you.

Kevin Chen

YI LIU

Hi Masayuki

I found the code work well for 8-bit image, however when I performed it on 16-bit image(noisy CT image), the result seemed not right, it was a complex number and very small,like 0 +1.3315e-008i. Can you tell me the reason? Thank you

Masayuki Tanaka

Hi zeenat khan,

I have added the code for generating the mask of the extracted weak-texture region.

Thanks.

zeenat khan

in your pdf you have shown images in your results but in code there are no figures. kindly let me know where should i show figure in order to see the weak texture patches. your code ony gives vallues and no figure

zeenat khan

i dont know where toy have changed the sigma values your pdf formulas and codes are different from each other.can you kindly add comments inside your code and also let me know which paper is related to your code.icip or nle_icip

Masayuki Tanaka

Hi zeenat khan,
You can find the pdfs from our project page:
http://bit.ly/NLest

zeenat khan

Masayuki Tanaka
hi i need your documentation as i have to present your code

Cindy

Masayuki Tanaka

Hi Akshay Gore,

You can download the dataset from:
https://www.eecs.berkeley.edu/Research/Projects/CS/vision/bsds/

Thanks!

Masayuki Tanaka

Hi Ashish,

I don't use the exact block toeplitz for two-dimensional image. As I commented, I used the different matrix.
my_convmtx2 generates the matrix associated to the following code:

imgh = imfilter(img,kh,'replicate');
imgh = imgh(:,2:size(imgh,2)-1,:);

Thanks.

Ashish Meshram (Meet)

Hi Masayuki

Yeah I saw that code but I've tried to get it done by toeplitz matrix only for Directional Derivative operator to calculate threshold and results are coming satisfactorily but takes time longer as compared to yours code.

Once it seems to be final I'll be uploading it.

Thanks for your reply....

Masayuki Tanaka

Hi Ashish Meshram,

You can find the source code of my_convmtx2 in the file of NoiseLevel.m.
Please check it out!

Thanks.

Masayuki Tanaka

Hi Ashish Meshram,

In the matlab code, I did not use the toeplitz matrix to calculate the
derivatives. I simply use the imfilter function instead of the matrix.
The matrix associated to the derivative operation in the matlab code is
not square matrix. The reason is to handle the borders of each patch
correctly.

Thanks.

AS mentioned in your paper at section III, equation no. 7, where by Dh and Dv are toeplitz matrix of N^2XN^2 but that not the case. For default patch size of 7 it should return 49X49 its return 35X49.

What the reason for this...

Thanks

Hello Masayuki Tanaka

Could you please mention some details about the function

T = my_convmtx2(H, m, n)

And if not possible here in, please refer me to some pointer

Thanks

Great job

Masayuki Tanaka

Hi Samuele Fiorini,

Thank you for your comment.
What kind of image and how much noise did you try?

Thanks.

Samuele Fiorini

It fails in case of very low noise, I cannot figure out why. Any help?

jackal tao

good

MATLAB Release Compatibility
Created with R2012a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!