%% show image and image contaminated with noise
% noise is uniformly distrbuted with mean zero
% the m-file energy.m is used

% S. Allen Broughton - 29 Sep 10

%% load and display picture
load mandrill
figure(1)
map = colormap(gray);
imagesc(X)

%% define noise
noise = 50*(rand(size(X))-0.5);
figure(2)
map = colormap(gray);
imagesc(noise)

%% add noise
figure(3)
map = colormap(gray);
imagesc(X+noise)

%% compute distortion
mD = 100*energy(noise)/energy(X)

%% show noise properties
M = mean(mean(noise)) % check mean
figure(4)
hist(noise(:),100) % histogram

