% Construct empirical point spread function (PSF)
%
% Samuli Siltanen Feb 2010

load blur100_1_PSFdata PSFdata
b1_1 = PSFdata;

% Pick out PSF from the image of a black dot 
%PSF = b1_1(199+[1:17],1037+[1:17]);
%PSF = b1_1(199+[1:17],1037+[1:17]);
PSF = b1_1(204+[1:17],619+[1:17]);

% Turn PSF upside down
PSF = max(max(PSF))-PSF;
% Symmetrize PSF
%PSF = PSF+PSF';
% Normalize PSF
PSF = PSF/sum(sum(PSF));

% Save PSF to file
save PSF PSF;

% Plot PSF
figure;
imagesc(PSF);
colormap gray;
axis equal;
axis tight;
