Mercurial > hg > smallbox
comparison util/Pierre_reconstruct.m @ 8:33850553b702
(none)
author | idamnjanovic |
---|---|
date | Mon, 22 Mar 2010 10:56:54 +0000 |
parents | |
children | fc395272d53e |
comparison
equal
deleted
inserted
replaced
7:0151f1ea080d | 8:33850553b702 |
---|---|
1 function reconstructed=Pierre_reconstruct(y, Problem) | |
2 %% Pierre Villars Example - reconstruction function | |
3 % This example is based on the experiment suggested by Professor Pierre | |
4 % Vandergheynst on the SMALL meeting in Villars. | |
5 | |
6 % using sparse representation y in dictionary Problem.A reconstruct the | |
7 % patches from the target image | |
8 | |
9 imout=Problem.A*y; | |
10 | |
11 % combine the patches into reconstructed image | |
12 | |
13 im=col2im(imout,Problem.blocksize,size(Problem.imageTrg),'disctint'); | |
14 | |
15 % bound the pixel values to [0,255] range | |
16 im(im<0)=0; | |
17 im(im>255)=255; | |
18 | |
19 %% output structure image+psnr %% | |
20 reconstructed.image=im; | |
21 reconstructed.psnr = 20*log10(Problem.maxval * sqrt(numel(Problem.imageTrg(:))) / norm(Problem.imageTrg(:)-im(:))); | |
22 end |