diff examples/Image Denoising/SMALL_ImgDenoise_DL_test_SPAMS_lambda.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_SPAMS_lambda.m	Tue Apr 05 17:03:26 2011 +0100
+++ b/examples/Image Denoising/SMALL_ImgDenoise_DL_test_SPAMS_lambda.m	Wed May 18 11:50:12 2011 +0100
@@ -1,5 +1,14 @@
 %% DICTIONARY LEARNING FOR IMAGE DENOISING
 %
+%   
+%   This file contains an example of how SMALLbox can be used to test different
+%   dictionary learning techniques in Image Denoising problem.
+%   This example can be used to test SPAMS for different values of
+%   parameter lambda. In no way it represents extensive testing of image
+%   denoising. It should only give an idea how SMALL structure can be used
+%   for testing.
+
+%
 %   Centre for Digital Music, Queen Mary, University of London.
 %   This file copyright 2010 Ivan Damnjanovic.
 %
@@ -8,14 +17,6 @@
 %   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.
-%   This example can be used to test SPAMS for different values of
-%   parameter lambda. In no way it represents extensive testing of image
-%   denoising. It should only give an idea how SMALL structure can be used
-%   for testing.
-%
 %%
 
 clear all;
@@ -86,25 +87,31 @@
     %   solver structures)
     
     SMALL.Problem.A = SMALL.DL(1).D;
-    
-    
-    %%
-    %   Initialising solver structure
-    %   Setting solver structure fields (toolbox, name, param, solution,
-    %   reconstructed and time) to zero values
-    
-    SMALL.solver(1)=SMALL_init_solver;
-    
-    % Defining the parameters needed for sparse representation
-    
-    SMALL.solver(1).toolbox='ompbox';
-    SMALL.solver(1).name='ompdenoise';
-    
-    %   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.Problem.reconstruct = @(x) ImgDenoise_reconstruct(x, SMALL.Problem);
+
+%%
+%   Initialising solver structure
+%   Setting solver structure fields (toolbox, name, param, solution,
+%   reconstructed and time) to zero values
+
+SMALL.solver(1)=SMALL_init_solver;
+
+% Defining the parameters needed for image denoising
+Edata=sqrt(prod(SMALL.Problem.blocksize)) * SMALL.Problem.sigma * SMALL.Problem.gain;
+maxatoms = floor(prod(SMALL.Problem.blocksize)/2);
+
+SMALL.solver(1).toolbox='ompbox';
+SMALL.solver(1).name='omp2';
+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 results %%
     %   This will show denoised image and dictionary for all lambdas. If you