annotate util/Pierre_reconstruct.m @ 8:33850553b702

(none)
author idamnjanovic
date Mon, 22 Mar 2010 10:56:54 +0000
parents
children fc395272d53e
rev   line source
idamnjanovic@8 1 function reconstructed=Pierre_reconstruct(y, Problem)
idamnjanovic@8 2 %% Pierre Villars Example - reconstruction function
idamnjanovic@8 3 % This example is based on the experiment suggested by Professor Pierre
idamnjanovic@8 4 % Vandergheynst on the SMALL meeting in Villars.
idamnjanovic@8 5
idamnjanovic@8 6 % using sparse representation y in dictionary Problem.A reconstruct the
idamnjanovic@8 7 % patches from the target image
idamnjanovic@8 8
idamnjanovic@8 9 imout=Problem.A*y;
idamnjanovic@8 10
idamnjanovic@8 11 % combine the patches into reconstructed image
idamnjanovic@8 12
idamnjanovic@8 13 im=col2im(imout,Problem.blocksize,size(Problem.imageTrg),'disctint');
idamnjanovic@8 14
idamnjanovic@8 15 % bound the pixel values to [0,255] range
idamnjanovic@8 16 im(im<0)=0;
idamnjanovic@8 17 im(im>255)=255;
idamnjanovic@8 18
idamnjanovic@8 19 %% output structure image+psnr %%
idamnjanovic@8 20 reconstructed.image=im;
idamnjanovic@8 21 reconstructed.psnr = 20*log10(Problem.maxval * sqrt(numel(Problem.imageTrg(:))) / norm(Problem.imageTrg(:)-im(:)));
idamnjanovic@8 22 end