code for white gaussian noise for image

12 ビュー (過去 30 日間)
nadia
nadia 2018 年 3 月 26 日
回答済み: Namwon Kim 2020 年 1 月 13 日
Hi, I have a Lena image with size 512X512 and I want to add white Gaussian noise with mean=0 and variance=10 to this image. do you have any code that do this for me? thanks in advance.

回答 (2 件)

Namwon Kim
Namwon Kim 2020 年 1 月 13 日
%% Code for White Gaussian Noise for Image
% noisy = (sqrt((Standard Deviation)^2)*randn(size(Lena_image))+mean + Lena_image
% Where (Standard Deviation)^2 is a variance, and
% [512, 512] = size(Lena_image)
Therefore,
load Lena % Input: Lena image
noisy = (sqrt(10)*randn(512,512))+0 + Lena;

Walter Roberson
Walter Roberson 2018 年 3 月 26 日
https://www.mathworks.com/help/images/ref/imnoise.html
  10 件のコメント
nadia
nadia 2018 年 4 月 3 日
are you sure? when I consider your solution with my double images(values are between [0 1]) the variance of difference of original image and noisy image is not about 10?
Walter Roberson
Walter Roberson 2018 年 4 月 3 日
A variance of 10 is not "suitable or double images" (that are in the range 0 to 1). Especially not if you think of the range 0 to 1 as being upper and lower bounds on representation and do not permit (say) -7 to +7 to be stored there to give room for a clear variance of 10. If you clamp at 0 to 1 then you can never get a variance of 10.

サインインしてコメントする。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by