annotate util/SMALL_AudioDeNoiseResult.m @ 36:e6191f5bb21b

(none)
author idamnjanovic
date Mon, 14 Mar 2011 15:32:52 +0000
parents fc395272d53e
children 8e660fd14774
rev   line source
idamnjanovic@8 1 function SMALL_AudioDeNoiseResult(SMALL)
idamnjanovic@24 2 %
idamnjanovic@24 3 % Centre for Digital Music, Queen Mary, University of London.
idamnjanovic@24 4 % This file copyright 2009 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
idamnjanovic@8 13 fMain=figure('Name', sprintf('File %s (training set size- %d, sigma - %d)',SMALL.Problem.name, SMALL.Problem.n, SMALL.Problem.sigma));
idamnjanovic@8 14 m=size(SMALL.solver,2);
idamnjanovic@8 15 maxval=SMALL.Problem.maxval;
idamnjanovic@8 16 au=SMALL.Problem.Original;
idamnjanovic@8 17 aunoise=SMALL.Problem.Noisy;
idamnjanovic@8 18
idamnjanovic@8 19 subplot(2, m, 1); plot(au/maxval);
idamnjanovic@8 20 title('Original audio');
idamnjanovic@8 21
idamnjanovic@8 22 subplot(2,m,2); plot(aunoise/maxval);
idamnjanovic@8 23 title(sprintf('Noisy audio, PSNR = %.2fdB', 20*log10(maxval * sqrt(numel(au)) / norm(au(:)-aunoise(:))) ));
idamnjanovic@8 24
idamnjanovic@8 25 for i=1:m
idamnjanovic@8 26 params=SMALL.solver(i).param;
idamnjanovic@8 27 sWav=subplot(2, m, m+i, 'Parent', fMain); plot(SMALL.solver(i).reconstructed.Image/maxval, 'Parent', sWav);
idamnjanovic@8 28 title(sprintf('%s Denoised audio, PSNR: %.2fdB', SMALL.DL(i).name, SMALL.solver(i).reconstructed.psnr),'Parent', sWav );
idamnjanovic@8 29 if strcmpi(SMALL.DL(i).name,'ksvds')
idamnjanovic@8 30 D = kron(SMALL.Problem.basedict{2},SMALL.Problem.basedict{1})*SMALL.DL(i).D;
idamnjanovic@8 31 else
idamnjanovic@8 32 D = SMALL.DL(i).D;
idamnjanovic@8 33 end
idamnjanovic@8 34 figure('Name', sprintf('%s dictionary in %.2f s', SMALL.DL(i).name, SMALL.DL(i).time));
idamnjanovic@8 35 imshow(D*255);
idamnjanovic@8 36 % n= size(D,2);
idamnjanovic@8 37 % sqrtn=round(sqrt(size(D,2)));
idamnjanovic@8 38 % for j=1:n
idamnjanovic@8 39 % subplot(sqrtn,sqrtn,j); plot(D(:,j));
idamnjanovic@8 40 % end
idamnjanovic@8 41 % dictimg = showdict(D,[params.blocksize 1],round(sqrt(size(D,2))),round(sqrt(size(D,2))),'lines','highcontrast');
idamnjanovic@8 42 %
idamnjanovic@8 43 % subplot(2,m,m+i);imshow(imresize(dictimg,2,'nearest'));
idamnjanovic@8 44 % title(sprintf('%s dictionary in %.2f s', SMALL.DL(i-1).name, SMALL.DL(i-1).time));
idamnjanovic@8 45
idamnjanovic@8 46 end