annotate util/SMALL_ImgDeNoiseResult.m @ 218:c38d965b5a1d luisf_dev

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