idamnjanovic@8: function SMALL_ImgDeNoiseResult(SMALL) idamnjanovic@24: % idamnjanovic@24: % Centre for Digital Music, Queen Mary, University of London. idamnjanovic@24: % This file copyright 2010 Ivan Damnjanovic. idamnjanovic@24: % idamnjanovic@24: % This program is free software; you can redistribute it and/or idamnjanovic@24: % modify it under the terms of the GNU General Public License as idamnjanovic@24: % published by the Free Software Foundation; either version 2 of the idamnjanovic@24: % License, or (at your option) any later version. See the file idamnjanovic@24: % COPYING included with this distribution for more information. idamnjanovic@24: % idamnjanovic@8: % Function gets as input SMALL structure and plots Image Denoise idamnjanovic@8: % results: Original Image, Noisy Image and for learned dictionaries and idamnjanovic@8: % denoised images idamnjanovic@8: idamnjanovic@8: idamnjanovic@8: figure('Name', sprintf('Image %s (training set size- %d, sigma - %d)',SMALL.Problem.name, SMALL.Problem.n, SMALL.Problem.sigma)); idamnjanovic@8: idamnjanovic@8: m=size(SMALL.solver,2)+1; idamnjanovic@8: maxval=SMALL.Problem.maxval; idamnjanovic@8: im=SMALL.Problem.Original; idamnjanovic@8: imnoise=SMALL.Problem.Noisy; idamnjanovic@8: idamnjanovic@8: subplot(2, m, 1); imshow(im/maxval); idamnjanovic@8: title('Original image'); idamnjanovic@8: idamnjanovic@8: subplot(2,m,m+1); imshow(imnoise/maxval); idamnjanovic@35: title(sprintf('Noisy image, PSNR = %.2fdB', SMALL.Problem.noisy_psnr )); idamnjanovic@8: idamnjanovic@8: for i=2:m idamnjanovic@35: idamnjanovic@34: subplot(2, m, i); imagesc(SMALL.solver(i-1).reconstructed.Image/maxval);colormap(gray); idamnjanovic@8: title(sprintf('%s Denoised image, PSNR: %.2f dB in %.2f s',... idamnjanovic@8: SMALL.DL(i-1).name, SMALL.solver(i-1).reconstructed.psnr, SMALL.solver(i-1).time )); idamnjanovic@8: if strcmpi(SMALL.DL(i-1).name,'ksvds') idamnjanovic@8: D = kron(SMALL.Problem.basedict{2},SMALL.Problem.basedict{1})*SMALL.DL(i-1).D; idamnjanovic@8: else idamnjanovic@8: D = SMALL.DL(i-1).D; idamnjanovic@8: end idamnjanovic@35: dictimg = showdict(D,SMALL.Problem.blocksize,... idamnjanovic@8: round(sqrt(size(D,2))),round(sqrt(size(D,2))),'lines','highcontrast'); idamnjanovic@8: idamnjanovic@34: subplot(2,m,m+i);imagesc(dictimg);colormap(gray); idamnjanovic@8: title(sprintf('%s dictionary in %.2f s',... idamnjanovic@8: SMALL.DL(i-1).name, SMALL.DL(i-1).time)); idamnjanovic@8: idamnjanovic@8: end