# HG changeset patch # User idamnjanovic # Date 1300117378 0 # Node ID 6a37442514c5947935164a60744fd63ade5292ba # Parent b9465d2bb3b02133718fc5ad73ab035d29ab8f69 diff -r b9465d2bb3b0 -r 6a37442514c5 Problems/Pierre_reconstruct.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Problems/Pierre_reconstruct.m Mon Mar 14 15:42:58 2011 +0000 @@ -0,0 +1,32 @@ +function reconstructed=Pierre_reconstruct(y, Problem) +%%% Pierre Villars Example - reconstruction function +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2009 Ivan Damnjanovic. +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License as +% published by the Free Software Foundation; either version 2 of the +% License, or (at your option) any later version. See the file +% COPYING included with this distribution for more information. +% +% This example is based on the experiment suggested by Professor Pierre +% Vandergheynst on the SMALL meeting in Villars. + +% using sparse representation y in dictionary Problem.A reconstruct the +% patches from the target image + +imout=Problem.A*y; + +% combine the patches into reconstructed image + +im=col2im(imout,Problem.blocksize,size(Problem.imageTrg),'disctint'); + +% bound the pixel values to [0,255] range +im(im<0)=0; +im(im>255)=255; + +%% output structure image+psnr %% +reconstructed.image=im; +reconstructed.psnr = 20*log10(Problem.maxval * sqrt(numel(Problem.imageTrg(:))) / norm(Problem.imageTrg(:)-im(:))); +end \ No newline at end of file