comparison Problems/Pierre_reconstruct.m @ 46:6a37442514c5

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