I am trying to calculate variance and mean of gaussian noise by adding it to uniform image using imnoise function as
image = rgb2gray(im2double(imread('flat_400.jpg'))); image(:,:) = 0.5; noisy_image = imnoise(image,'gaussian',0,0.8);
and then am trying to calculate mean and variance using
mean_image = sum(sum(noisy_image))/(size(noisy_image,1)*size(noisy_image,2)) variance = sum(sum((noisy_image - mean_image).^2))/((size(noisy_image,1)*size(noisy_image,2)) - 1)
but the variance and mean are far from the added noise. Can anyone please tell me what's the reason of it?
No products are associated with this question.
Hi. Your noise is very large and the output image must be between 0 and 1, so the values greater than 1 became 1 and values less than 0 became zero.
Gaussian noise can be defined: