The value of variance in function imnoise in case of gaussian is a bit confusing

조회 수: 7 (최근 30일)
Hi Everyone,
I am trying to add gaussian noise to image with some variance and mean, generally variance of 50 is considerable, but the function imnoise make image so much noisy even for a variance of 0.1,
image = rgb2gray(imread('pepper.jpg')); noisy_image = imnoise(image,'gaussian',0,0.1);
I just wanna ask that is this variance normalized using any specific scale, if yes, then with what factor do I need to multiply it to get the original one.

채택된 답변

Wayne King
Wayne King 2013년 4월 2일
imnoise works with an intensity image, so if you are inputting a unit8 image for example with values in the range [0,255], then imnoise first does
I = imread('eight.tif');
I = im2double(I);
before adding the Gaussian noise, so basically you scale every value in your image [0,255] by 255 so that it falls into the interval [0,1] and then add the noise to that.
  댓글 수: 1
Image Analyst
Image Analyst 2013년 4월 2일
Then if you want a uint8 image back int he original range you need to multiply by 255 and cast to uint8
noisyImage = uint8(255 * noisyImage);
If you just multiply by 255 but don't cast to uint8, then you can do that but you'll have to use [] everytime you display it:
imshow(noisyImage, []);
or else it will show up as all white.

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

추가 답변 (1개)

Sajid Khan
Sajid Khan 2013년 4월 9일
Thanks you so much for your kind reply, your answer really is helpful. Can you please tell me what is the maximum gaussian noise variance for an 8 bit image that I can add?
  댓글 수: 1
Image Analyst
Image Analyst 2013년 4월 9일
That would be 255. Actually you can add anything but whenever the sum would exceed 255 it will get clipped at 255 because it's uint8. The most you can add without clipping is 255, which would only happen when added to a value of 0.

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

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by