annotate util/SMALL_AudioDeNoiseResult.m @ 247:ecce33192fcc tip

Added tag ver_2.1 for changeset cef4500b936f
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Wed, 31 Oct 2012 12:24:44 +0000
parents f42aa8bcb82f
children
rev   line source
idamnjanovic@8 1 function SMALL_AudioDeNoiseResult(SMALL)
ivan@128 2 %% Plots the results of Audio denoising experiment - underconstruction
ivan@128 3
idamnjanovic@24 4 % Centre for Digital Music, Queen Mary, University of London.
ivan@161 5 % This file copyright 2011 Ivan Damnjanovic.
idamnjanovic@24 6 %
idamnjanovic@24 7 % This program is free software; you can redistribute it and/or
idamnjanovic@24 8 % modify it under the terms of the GNU General Public License as
idamnjanovic@24 9 % published by the Free Software Foundation; either version 2 of the
idamnjanovic@24 10 % License, or (at your option) any later version. See the file
idamnjanovic@24 11 % COPYING included with this distribution for more information.
idamnjanovic@24 12 %
idamnjanovic@8 13
idamnjanovic@8 14 fMain=figure('Name', sprintf('File %s (training set size- %d, sigma - %d)',SMALL.Problem.name, SMALL.Problem.n, SMALL.Problem.sigma));
idamnjanovic@8 15 m=size(SMALL.solver,2);
ivan@161 16 maxval=max(SMALL.Problem.Original);
idamnjanovic@8 17 au=SMALL.Problem.Original;
idamnjanovic@8 18 aunoise=SMALL.Problem.Noisy;
idamnjanovic@8 19
idamnjanovic@8 20 subplot(2, m, 1); plot(au/maxval);
idamnjanovic@8 21 title('Original audio');
idamnjanovic@8 22
idamnjanovic@8 23 subplot(2,m,2); plot(aunoise/maxval);
idamnjanovic@8 24 title(sprintf('Noisy audio, PSNR = %.2fdB', 20*log10(maxval * sqrt(numel(au)) / norm(au(:)-aunoise(:))) ));
idamnjanovic@8 25
idamnjanovic@8 26 for i=1:m
idamnjanovic@8 27 params=SMALL.solver(i).param;
ivan@161 28 sWav=subplot(2, m, m+i, 'Parent', fMain); plot(SMALL.solver(i).reconstructed.audio/maxval, 'Parent', sWav);
idamnjanovic@8 29 title(sprintf('%s Denoised audio, PSNR: %.2fdB', SMALL.DL(i).name, SMALL.solver(i).reconstructed.psnr),'Parent', sWav );
idamnjanovic@8 30 if strcmpi(SMALL.DL(i).name,'ksvds')
idamnjanovic@8 31 D = kron(SMALL.Problem.basedict{2},SMALL.Problem.basedict{1})*SMALL.DL(i).D;
idamnjanovic@8 32 else
idamnjanovic@8 33 D = SMALL.DL(i).D;
idamnjanovic@8 34 end
idamnjanovic@8 35 figure('Name', sprintf('%s dictionary in %.2f s', SMALL.DL(i).name, SMALL.DL(i).time));
idamnjanovic@8 36 imshow(D*255);
idamnjanovic@8 37 % n= size(D,2);
idamnjanovic@8 38 % sqrtn=round(sqrt(size(D,2)));
idamnjanovic@8 39 % for j=1:n
idamnjanovic@8 40 % subplot(sqrtn,sqrtn,j); plot(D(:,j));
idamnjanovic@8 41 % end
idamnjanovic@8 42 % dictimg = showdict(D,[params.blocksize 1],round(sqrt(size(D,2))),round(sqrt(size(D,2))),'lines','highcontrast');
idamnjanovic@8 43 %
idamnjanovic@8 44 % subplot(2,m,m+i);imshow(imresize(dictimg,2,'nearest'));
idamnjanovic@8 45 % title(sprintf('%s dictionary in %.2f s', SMALL.DL(i-1).name, SMALL.DL(i-1).time));
idamnjanovic@8 46
idamnjanovic@8 47 end