%
% Optical Imaging and Spectroscopy
%
% David J. Brady
% Duke University
% www.opticalimaging.org
%
% Figure 8.18 Richardson-Lucy estimation of flowers image
%
figure(1);
set(gcf,'color','white');
colormap gray;
load flowers;
dog=dog/max(max(dog));
dog=[zeros(100,456);zeros(256,100),dog,zeros(256,100);zeros(100,456)];
sigma=0.01;
data=conv2(dog,ones(4)/16,'same');
dog=dog(101:356,101:356);
data=data+sigma*randn(size(data));
dipdata=deconvlucy(data,ones(4),10);
dipdata=dipdata(101:356,101:356);
subplot(1,2,1);imagesc(dipdata(100:150,100:150));axis off; axis image;
title(['11110000 mse='  num2str(mean(mean((dipdata-dog).^2)),'%5.2e')]);
%subplot(1,2,1);imagesc(dog(100:150,100:150));axis off; axis image;title('original');
dog=[zeros(100,456);zeros(256,100),dog,zeros(256,100);zeros(100,456)];
sigma=0.01;
psf=[1 1 1 0 0 1 0 0]'*[1 1 1 0 0 1 0 0];psf=psf/16;
data=conv2(dog,psf,'same');
dog=dog(101:356,101:356);
data=data+sigma*randn(size(data));
dipdata=deconvlucy(data,ones(4),10);
dipdata=dipdata(101:356,101:356);
subplot(1,2,2);imagesc(dipdata(100:150,100:150));axis off; axis image;
title(['11100100 mse='  num2str(mean(mean((dipdata-dog).^2)),'%5.2e')]);


