imnoise gaussian variance vs normal variance?

7 ビュー (過去 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 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by