annotate util/SMALL_ImgDeNoiseResult.m.orig @ 170:68fb71aa5339 danieleb

Added dictionary decorrelation functions and test script for Letters paper.
author Daniele Barchiesi <daniele.barchiesi@eecs.qmul.ac.uk>
date Thu, 06 Oct 2011 14:33:41 +0100
parents 855aa3288394
children
rev   line source
daniele@158 1 function SMALL_ImgDeNoiseResult(SMALL)
daniele@158 2 %% Represents the results of Dictionary Learning for Image denoising
daniele@158 3 %
daniele@158 4 % Function gets as input SMALL structure and plots Image Denoise
daniele@158 5 % results: Original Image, Noisy Image and for learned dictionaries and
daniele@158 6 % denoised images
daniele@158 7 %
daniele@158 8
daniele@158 9 % Centre for Digital Music, Queen Mary, University of London.
daniele@158 10 % This file copyright 2010 Ivan Damnjanovic.
daniele@158 11 %
daniele@158 12 % This program is free software; you can redistribute it and/or
daniele@158 13 % modify it under the terms of the GNU General Public License as
daniele@158 14 % published by the Free Software Foundation; either version 2 of the
daniele@158 15 % License, or (at your option) any later version. See the file
daniele@158 16 % COPYING included with this distribution for more information.
daniele@158 17 %%
daniele@158 18
daniele@158 19
daniele@158 20 figure('Name', sprintf('Image %s (training set size- %d, sigma - %d)',SMALL.Problem.name, SMALL.Problem.n, SMALL.Problem.sigma));
daniele@158 21
daniele@158 22 m=size(SMALL.solver,2)+1;
daniele@158 23 maxval=SMALL.Problem.maxval;
daniele@158 24 im=SMALL.Problem.Original;
daniele@158 25 imnoise=SMALL.Problem.Noisy;
daniele@158 26
daniele@158 27 subplot(2, m, 1); imagesc(im/maxval);colormap(gray);axis off; axis image; % Set aspect ratio to obtain square pixels
daniele@158 28 title('Original image');
daniele@158 29
daniele@158 30 subplot(2,m,m+1); imagesc(imnoise/maxval);axis off; axis image;
daniele@158 31 title(sprintf('Noisy image, PSNR = %.2fdB', SMALL.Problem.noisy_psnr ));
daniele@158 32
daniele@158 33 for i=2:m
daniele@158 34
daniele@158 35 subplot(2, m, i); imagesc(SMALL.solver(i-1).reconstructed.Image/maxval);axis off; axis image;
daniele@158 36 title(sprintf('%s Denoised image, PSNR: %.2f dB in %.2f s',...
daniele@158 37 SMALL.DL(i-1).name, SMALL.solver(i-1).reconstructed.psnr, SMALL.solver(i-1).time ),'Interpreter','none');
daniele@158 38 if strcmpi(SMALL.DL(i-1).name,'ksvds')
daniele@158 39 D = kron(SMALL.Problem.basedict{2},SMALL.Problem.basedict{1})*SMALL.DL(i-1).D;
daniele@158 40 else
daniele@158 41 D = SMALL.DL(i-1).D;
daniele@158 42 end
daniele@158 43 dictimg = SMALL_showdict(D,SMALL.Problem.blocksize,...
daniele@158 44 round(sqrt(size(D,2))),round(sqrt(size(D,2))),'lines','highcontrast');
daniele@158 45
daniele@158 46 subplot(2,m,m+i);imagesc(dictimg);axis off; axis image;
daniele@158 47 title(sprintf('%s dictionary in %.2f s',...
daniele@158 48 SMALL.DL(i-1).name, SMALL.DL(i-1).time),'Interpreter','none');
daniele@158 49
daniele@158 50 end