annotate util/SMALL_ImgDeNoiseResult.m @ 8:33850553b702

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