I'm trying to add Gaussian noise to grayscale image and then display its histogram. It displays Gaussian curve but there are heights for 0 and 255 grayscale values. Isnt it supposed to be 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);
As explained in Matlab's manual (http://nl.mathworks.com/help/images/ref/imnoise.html?searchHighlight=imnoise)
Note The mean and variance parameters for 'gaussian', 'localvar', 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.