idamnjanovic@46: function reconstructed=Pierre_reconstruct(y, Problem) ivan@128: %% Pierre Villars Example - reconstruction function ivan@128: % ivan@128: % This example is based on the experiment suggested by Professor Pierre ivan@128: % Vandergheynst on the SMALL meeting in Villars. ivan@128: % The function is using sparse representation y in dictionary Problem.A ivan@128: % to reconstruct the patches of the target image. ivan@128: idamnjanovic@46: % idamnjanovic@46: % Centre for Digital Music, Queen Mary, University of London. idamnjanovic@46: % This file copyright 2009 Ivan Damnjanovic. idamnjanovic@46: % idamnjanovic@46: % This program is free software; you can redistribute it and/or idamnjanovic@46: % modify it under the terms of the GNU General Public License as idamnjanovic@46: % published by the Free Software Foundation; either version 2 of the idamnjanovic@46: % License, or (at your option) any later version. See the file idamnjanovic@46: % COPYING included with this distribution for more information. ivan@128: %% idamnjanovic@46: ivan@128: ivan@128: idamnjanovic@46: idamnjanovic@46: imout=Problem.A*y; idamnjanovic@46: idamnjanovic@46: % combine the patches into reconstructed image idamnjanovic@46: idamnjanovic@46: im=col2im(imout,Problem.blocksize,size(Problem.imageTrg),'disctint'); idamnjanovic@46: idamnjanovic@46: % bound the pixel values to [0,255] range idamnjanovic@46: im(im<0)=0; idamnjanovic@46: im(im>255)=255; idamnjanovic@46: idamnjanovic@46: %% output structure image+psnr %% idamnjanovic@46: reconstructed.image=im; idamnjanovic@46: reconstructed.psnr = 20*log10(Problem.maxval * sqrt(numel(Problem.imageTrg(:))) / norm(Problem.imageTrg(:)-im(:))); idamnjanovic@46: end