annotate util/SMALL_ImgDeNoiseResult.m @ 71:165e3b249170

(none)
author idamnjanovic
date Wed, 16 Mar 2011 16:28:03 +0000
parents ea9ef4bd7102
children 62f20b91d870
rev   line source
idamnjanovic@8 1 function SMALL_ImgDeNoiseResult(SMALL)
idamnjanovic@24 2 %
idamnjanovic@24 3 % Centre for Digital Music, Queen Mary, University of London.
idamnjanovic@24 4 % This file copyright 2010 Ivan Damnjanovic.
idamnjanovic@24 5 %
idamnjanovic@24 6 % This program is free software; you can redistribute it and/or
idamnjanovic@24 7 % modify it under the terms of the GNU General Public License as
idamnjanovic@24 8 % published by the Free Software Foundation; either version 2 of the
idamnjanovic@24 9 % License, or (at your option) any later version. See the file
idamnjanovic@24 10 % COPYING included with this distribution for more information.
idamnjanovic@24 11 %
idamnjanovic@8 12 % Function gets as input SMALL structure and plots Image Denoise
idamnjanovic@8 13 % results: Original Image, Noisy Image and for learned dictionaries and
idamnjanovic@8 14 % denoised images
idamnjanovic@8 15
idamnjanovic@8 16
idamnjanovic@8 17 figure('Name', sprintf('Image %s (training set size- %d, sigma - %d)',SMALL.Problem.name, SMALL.Problem.n, SMALL.Problem.sigma));
idamnjanovic@8 18
idamnjanovic@8 19 m=size(SMALL.solver,2)+1;
idamnjanovic@8 20 maxval=SMALL.Problem.maxval;
idamnjanovic@8 21 im=SMALL.Problem.Original;
idamnjanovic@8 22 imnoise=SMALL.Problem.Noisy;
idamnjanovic@8 23
idamnjanovic@8 24 subplot(2, m, 1); imshow(im/maxval);
idamnjanovic@8 25 title('Original image');
idamnjanovic@8 26
idamnjanovic@8 27 subplot(2,m,m+1); imshow(imnoise/maxval);
idamnjanovic@35 28 title(sprintf('Noisy image, PSNR = %.2fdB', SMALL.Problem.noisy_psnr ));
idamnjanovic@8 29
idamnjanovic@8 30 for i=2:m
idamnjanovic@35 31
idamnjanovic@34 32 subplot(2, m, i); imagesc(SMALL.solver(i-1).reconstructed.Image/maxval);colormap(gray);
idamnjanovic@8 33 title(sprintf('%s Denoised image, PSNR: %.2f dB in %.2f s',...
idamnjanovic@8 34 SMALL.DL(i-1).name, SMALL.solver(i-1).reconstructed.psnr, SMALL.solver(i-1).time ));
idamnjanovic@8 35 if strcmpi(SMALL.DL(i-1).name,'ksvds')
idamnjanovic@8 36 D = kron(SMALL.Problem.basedict{2},SMALL.Problem.basedict{1})*SMALL.DL(i-1).D;
idamnjanovic@8 37 else
idamnjanovic@8 38 D = SMALL.DL(i-1).D;
idamnjanovic@8 39 end
idamnjanovic@35 40 dictimg = showdict(D,SMALL.Problem.blocksize,...
idamnjanovic@8 41 round(sqrt(size(D,2))),round(sqrt(size(D,2))),'lines','highcontrast');
idamnjanovic@8 42
idamnjanovic@34 43 subplot(2,m,m+i);imagesc(dictimg);colormap(gray);
idamnjanovic@8 44 title(sprintf('%s dictionary in %.2f s',...
idamnjanovic@8 45 SMALL.DL(i-1).name, SMALL.DL(i-1).time));
idamnjanovic@8 46
idamnjanovic@8 47 end