% Optical Imaging and Spectroscopy
%
% David J. Brady
% Duke University
% www.opticalimaging.org
%
%figure 8.8
%
figure(1);
set(gcf,'color','white');
colormap gray;
%dog=double(imread('cameraman.tif'));
%dog=double(imread('nycN.jpg'));
load flowers;
dog=dog/max(max(dog));
sigma=0.01;
lambda=0.3;
N=4;
Hl=toeplitz([1/N zeros(1,255)],[ones(1, N)/N,zeros(1,256-N)]);
Hr=Hl;
dData=Hl*dog*Hr'+sigma*randn(size(dog));
dNoise=pinv(Hl'*Hl+lambda^2*eye(256))*Hl'*dData*Hr*pinv(Hr*Hr'+lambda^2*eye(256));
subplot(2,1,1);imagesc(dNoise,[0 1]);axis image; axis off;
title(['Tikhonov reconstruction mse=' num2str(mean(mean((dNoise-dog).^2)),'%5.2e')]);
subplot(2,2,3);imagesc(dog(100:150,100:150));axis off; axis image;
subplot(2,2,4);imagesc(dNoise(100:150,100:150));axis off; axis image;
%
%
