Why Matlab Gaussian Noise increases 0 and 255 values?

I am trying to add gaussian noise to a grayscale image and then display its histogram. It displays a Gaussian curve, but there are heights for 0 and 255 grayscale values. Shouldn't it be a pure Gaussian curve?

Here is my code

clc
clear all

I = imread('lena.tiff');
I = rgb2gray(I);

N = imnoise(I,'gaussian',0,0.025);

figure; [counts,x] = imhist(N);
stem(x,counts);

      

+3


source to share


1 answer


As explained in the Matlab manual ( http://nl.mathworks.com/help/images/ref/imnoise.html?searchHighlight=imnoise )



Note. The mean and variance parameters for the Gaussian, local, and speckle noise types are always specified as if the image were of class double in the range [0, 1]. If the input image is of class uint8 or uint16, the imnoise function converts the image to double, adds noise according to the specified type and parameters, and then converts the noisy image back to the same class as the input.

+2


source







All Articles