imnoise gaussian variance vs normal variance?
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Zhouyang Xu
am 14 Mär. 2021
Kommentiert: Zhouyang Xu
am 17 Mär. 2021
Dear MATLAB community,
I'm currently trying to understand the imnoise function, if I create an image of just ones and add gaussian noise of 1e^-4 to it, the variance of teh output image is not any where close to that value, it seems to have a corrolation of 0.34 times the gaussian variance in imnoise.
img = ones(500);
img = imnoise(img,"gaussian",0,1e-4);
var(img(:))
Would anyone be kind enough to explain this to me?
Thank you very much! Really appreciate your support!
0 Kommentare
Akzeptierte Antwort
Uday Pradhan
am 17 Mär. 2021
Hi,
So the formula for adding Gaussian noise to the image by "imnoise" is given by:
output = input + sqrt(v)*randn(size(input)) + mu; %v is the provided variance and mu the mean
output = max(0,min(output,1)); %truncating the output to the range [0,1]
Now, in the first line, we are drawing 500*500 random values from a normal distribution with a mean of "mu" and variance "v". The mean and variance of the drawn sample will not exactly be "mu" and "v" because they are calculated from a sampling of the distribution. Also, the variance of the output is affected by the truncation step.
You can check the variance of the added noise multiple times to observe how it varies from the user - input variance to imnoise, by using the above formula instead.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!