Mercurial > hg > smallbox
annotate Problems/Pierre_reconstruct.m @ 186:9c418bea7f6a bug_386
Addresses Bug #386: removed the 4th output variable (versn) in all calls of function fileparts.
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Thu, 09 Feb 2012 17:25:14 +0000 |
parents | 8e660fd14774 |
children |
rev | line source |
---|---|
idamnjanovic@46 | 1 function reconstructed=Pierre_reconstruct(y, Problem) |
ivan@128 | 2 %% Pierre Villars Example - reconstruction function |
ivan@128 | 3 % |
ivan@128 | 4 % This example is based on the experiment suggested by Professor Pierre |
ivan@128 | 5 % Vandergheynst on the SMALL meeting in Villars. |
ivan@128 | 6 % The function is using sparse representation y in dictionary Problem.A |
ivan@128 | 7 % to reconstruct the patches of the target image. |
ivan@128 | 8 |
idamnjanovic@46 | 9 % |
idamnjanovic@46 | 10 % Centre for Digital Music, Queen Mary, University of London. |
idamnjanovic@46 | 11 % This file copyright 2009 Ivan Damnjanovic. |
idamnjanovic@46 | 12 % |
idamnjanovic@46 | 13 % This program is free software; you can redistribute it and/or |
idamnjanovic@46 | 14 % modify it under the terms of the GNU General Public License as |
idamnjanovic@46 | 15 % published by the Free Software Foundation; either version 2 of the |
idamnjanovic@46 | 16 % License, or (at your option) any later version. See the file |
idamnjanovic@46 | 17 % COPYING included with this distribution for more information. |
ivan@128 | 18 %% |
idamnjanovic@46 | 19 |
ivan@128 | 20 |
ivan@128 | 21 |
idamnjanovic@46 | 22 |
idamnjanovic@46 | 23 imout=Problem.A*y; |
idamnjanovic@46 | 24 |
idamnjanovic@46 | 25 % combine the patches into reconstructed image |
idamnjanovic@46 | 26 |
idamnjanovic@46 | 27 im=col2im(imout,Problem.blocksize,size(Problem.imageTrg),'disctint'); |
idamnjanovic@46 | 28 |
idamnjanovic@46 | 29 % bound the pixel values to [0,255] range |
idamnjanovic@46 | 30 im(im<0)=0; |
idamnjanovic@46 | 31 im(im>255)=255; |
idamnjanovic@46 | 32 |
idamnjanovic@46 | 33 %% output structure image+psnr %% |
idamnjanovic@46 | 34 reconstructed.image=im; |
idamnjanovic@46 | 35 reconstructed.psnr = 20*log10(Problem.maxval * sqrt(numel(Problem.imageTrg(:))) / norm(Problem.imageTrg(:)-im(:))); |
idamnjanovic@46 | 36 end |