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