diff examples/Image Denoising/SMALL_ImgDenoise_DL_test_Training_size.m @ 107:dab78a3598b6

changes to comments for couple of scripts
author Ivan Damnjanovic lnx <ivan.damnjanovic@eecs.qmul.ac.uk>
date Wed, 18 May 2011 11:50:12 +0100
parents cbf3521c25eb
children 8e660fd14774
line wrap: on
line diff
--- a/examples/Image Denoising/SMALL_ImgDenoise_DL_test_Training_size.m	Tue Apr 05 17:03:26 2011 +0100
+++ b/examples/Image Denoising/SMALL_ImgDenoise_DL_test_Training_size.m	Wed May 18 11:50:12 2011 +0100
@@ -1,14 +1,6 @@
 %% DICTIONARY LEARNING FOR IMAGE DENOISING
 %
-%   Centre for Digital Music, Queen Mary, University of London.
-%   This file copyright 20100 Ivan Damnjanovic.
-%
-%   This program is free software; you can redistribute it and/or
-%   modify it under the terms of the GNU General Public License as
-%   published by the Free Software Foundation; either version 2 of the
-%   License, or (at your option) any later version.  See the file
-%   COPYING included with this distribution for more information.
-%   
+   
 %   This file contains an example of how SMALLbox can be used to test different
 %   dictionary learning techniques in Image Denoising problem.
 %   It calls generateImageDenoiseProblem that will let you to choose image,
@@ -25,8 +17,16 @@
 %   -   SPAMS - J. Mairal, F. Bach, J. Ponce and G. Sapiro. Online
 %               Dictionary Learning for Sparse Coding. International
 %               Conference on Machine Learning,Montreal, Canada, 2009
+
 %
+%   Centre for Digital Music, Queen Mary, University of London.
+%   This file copyright 2010 Ivan Damnjanovic.
 %
+%   This program is free software; you can redistribute it and/or
+%   modify it under the terms of the GNU General Public License as
+%   published by the Free Software Foundation; either version 2 of the
+%   License, or (at your option) any later version.  See the file
+%   COPYING included with this distribution for more information.%%
 %%
 
 clear all;
@@ -77,6 +77,8 @@
     %   Type help ksvd in MATLAB prompt for more options.
     
     Edata=sqrt(prod(SMALL.Problem.blocksize)) * SMALL.Problem.sigma * SMALL.Problem.gain;
+    maxatoms = floor(prod(SMALL.Problem.blocksize)/2);
+    
     SMALL.DL(1).param=struct(...
         'Edata', Edata,...
         'initdict', SMALL.Problem.initdict,...
@@ -94,7 +96,7 @@
     %   solver structures)
     
     SMALL.Problem.A = SMALL.DL(1).D;
-    
+    SMALL.Problem.reconstruct = @(x) ImgDenoise_reconstruct(x, SMALL.Problem);
     
     %%
     %   Initialising solver structure
@@ -107,12 +109,23 @@
     % Defining the parameters needed for denoising
     
     SMALL.solver(1).toolbox='ompbox';
-    SMALL.solver(1).name='ompdenoise';
+    SMALL.solver(1).name='omp2';
     
-    %   Denoising the image - SMALL_denoise function is similar to SMALL_solve,
-    %   but backward compatible with KSVD definition of denoising
-    
-    SMALL.solver(1)=SMALL_denoise(SMALL.Problem, SMALL.solver(1));
+    SMALL.solver(1).param=struct(...
+        'epsilon',Edata,...
+        'maxatoms', maxatoms); 
+
+    %   Denoising the image - find the sparse solution in the learned
+    %   dictionary for all patches in the image and the end it uses
+    %   reconstruction function to reconstruct the patches and put them into a
+    %   denoised image
+
+    SMALL.solver(1)=SMALL_solve(SMALL.Problem, SMALL.solver(1));
+
+    %   Show PSNR after reconstruction
+
+    SMALL.solver(1).reconstructed.psnr
+
     
     %%
     %   Use SPAMS Online Dictionary Learning Algorithm
@@ -150,7 +163,7 @@
     %   solver structures)
     
     SMALL.Problem.A = SMALL.DL(2).D;
-    
+    SMALL.Problem.reconstruct = @(x) ImgDenoise_reconstruct(x, SMALL.Problem);
     
     %%
     %   Initialising solver structure
@@ -162,12 +175,18 @@
     % Defining the parameters needed for denoising
     
     SMALL.solver(2).toolbox='ompbox';
-    SMALL.solver(2).name='ompdenoise';
-    
-    %   Denoising the image - SMALL_denoise function is similar to SMALL_solve,
-    %   but backward compatible with KSVD definition of denoising
-    
-    SMALL.solver(2)=SMALL_denoise(SMALL.Problem, SMALL.solver(2));
+    SMALL.solver(2).name='omp2';
+    SMALL.solver(2).param=struct(...
+        'epsilon',Edata,...
+        'maxatoms', maxatoms); 
+
+    %   Denoising the image - find the sparse solution in the learned
+    %   dictionary for all patches in the image and the end it uses
+    %   reconstruction function to reconstruct the patches and put them into a
+    %   denoised image
+
+    SMALL.solver(2)=SMALL_solve(SMALL.Problem, SMALL.solver(2));
+