diff util/Pierre_reconstruct.m @ 8:33850553b702

(none)
author idamnjanovic
date Mon, 22 Mar 2010 10:56:54 +0000
parents
children fc395272d53e
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/util/Pierre_reconstruct.m	Mon Mar 22 10:56:54 2010 +0000
@@ -0,0 +1,22 @@
+function reconstructed=Pierre_reconstruct(y, Problem)
+%%  Pierre Villars Example - reconstruction function
+%   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