annotate util/Pierre_reconstruct.m @ 125:002ec1b2ceff sup_158_IMG_Processing_toolbox_

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