Mercurial > hg > smallbox
comparison util/SMALL_ImgDeNoiseResult.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 SMALL_ImgDeNoiseResult(SMALL) | |
2 % Ivan Damnjanovic 2010 | |
3 % Function gets as input SMALL structure and plots Image Denoise | |
4 % results: Original Image, Noisy Image and for learned dictionaries and | |
5 % denoised images | |
6 | |
7 | |
8 figure('Name', sprintf('Image %s (training set size- %d, sigma - %d)',SMALL.Problem.name, SMALL.Problem.n, SMALL.Problem.sigma)); | |
9 | |
10 m=size(SMALL.solver,2)+1; | |
11 maxval=SMALL.Problem.maxval; | |
12 im=SMALL.Problem.Original; | |
13 imnoise=SMALL.Problem.Noisy; | |
14 | |
15 subplot(2, m, 1); imshow(im/maxval); | |
16 title('Original image'); | |
17 | |
18 subplot(2,m,m+1); imshow(imnoise/maxval); | |
19 title(sprintf('Noisy image, PSNR = %.2fdB', 20*log10(maxval * sqrt(numel(im)) / norm(im(:)-imnoise(:))) )); | |
20 | |
21 for i=2:m | |
22 params=SMALL.solver(i-1).param; | |
23 subplot(2, m, i); imshow(SMALL.solver(i-1).reconstructed.Image/maxval); | |
24 title(sprintf('%s Denoised image, PSNR: %.2f dB in %.2f s',... | |
25 SMALL.DL(i-1).name, SMALL.solver(i-1).reconstructed.psnr, SMALL.solver(i-1).time )); | |
26 if strcmpi(SMALL.DL(i-1).name,'ksvds') | |
27 D = kron(SMALL.Problem.basedict{2},SMALL.Problem.basedict{1})*SMALL.DL(i-1).D; | |
28 else | |
29 D = SMALL.DL(i-1).D; | |
30 end | |
31 dictimg = showdict(D,params.blocksize,... | |
32 round(sqrt(size(D,2))),round(sqrt(size(D,2))),'lines','highcontrast'); | |
33 | |
34 subplot(2,m,m+i);imshow(imresize(dictimg,2,'nearest')); | |
35 title(sprintf('%s dictionary in %.2f s',... | |
36 SMALL.DL(i-1).name, SMALL.DL(i-1).time)); | |
37 | |
38 end |