imnoise gaussian variance vs normal variance?

조회 수: 4 (최근 30일)
Zhouyang Xu
Zhouyang Xu 2021년 3월 14일
댓글: Zhouyang Xu 2021년 3월 17일
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!

채택된 답변

Uday Pradhan
Uday Pradhan 2021년 3월 17일
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.
  댓글 수: 1
Zhouyang Xu
Zhouyang Xu 2021년 3월 17일
Thank you very much, that is very helpful

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by