annotate Problems/Pierre_reconstruct.m @ 46:6a37442514c5

(none)
author idamnjanovic
date Mon, 14 Mar 2011 15:42:58 +0000
parents
children 8e660fd14774
rev   line source
idamnjanovic@46 1 function reconstructed=Pierre_reconstruct(y, Problem)
idamnjanovic@46 2 %%% Pierre Villars Example - reconstruction function
idamnjanovic@46 3 %
idamnjanovic@46 4 % Centre for Digital Music, Queen Mary, University of London.
idamnjanovic@46 5 % This file copyright 2009 Ivan Damnjanovic.
idamnjanovic@46 6 %
idamnjanovic@46 7 % This program is free software; you can redistribute it and/or
idamnjanovic@46 8 % modify it under the terms of the GNU General Public License as
idamnjanovic@46 9 % published by the Free Software Foundation; either version 2 of the
idamnjanovic@46 10 % License, or (at your option) any later version. See the file
idamnjanovic@46 11 % COPYING included with this distribution for more information.
idamnjanovic@46 12 %
idamnjanovic@46 13 % This example is based on the experiment suggested by Professor Pierre
idamnjanovic@46 14 % Vandergheynst on the SMALL meeting in Villars.
idamnjanovic@46 15
idamnjanovic@46 16 % using sparse representation y in dictionary Problem.A reconstruct the
idamnjanovic@46 17 % patches from the target image
idamnjanovic@46 18
idamnjanovic@46 19 imout=Problem.A*y;
idamnjanovic@46 20
idamnjanovic@46 21 % combine the patches into reconstructed image
idamnjanovic@46 22
idamnjanovic@46 23 im=col2im(imout,Problem.blocksize,size(Problem.imageTrg),'disctint');
idamnjanovic@46 24
idamnjanovic@46 25 % bound the pixel values to [0,255] range
idamnjanovic@46 26 im(im<0)=0;
idamnjanovic@46 27 im(im>255)=255;
idamnjanovic@46 28
idamnjanovic@46 29 %% output structure image+psnr %%
idamnjanovic@46 30 reconstructed.image=im;
idamnjanovic@46 31 reconstructed.psnr = 20*log10(Problem.maxval * sqrt(numel(Problem.imageTrg(:))) / norm(Problem.imageTrg(:)-im(:)));
idamnjanovic@46 32 end