Mercurial > hg > smallbox
comparison 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 |
comparison
equal
deleted
inserted
replaced
85:fd1c32cda22c | 107:dab78a3598b6 |
---|---|
1 %% DICTIONARY LEARNING FOR IMAGE DENOISING | 1 %% DICTIONARY LEARNING FOR IMAGE DENOISING |
2 % | |
3 % | |
4 % This file contains an example of how SMALLbox can be used to test different | |
5 % dictionary learning techniques in Image Denoising problem. | |
6 % This example can be used to test SPAMS for different values of | |
7 % parameter lambda. In no way it represents extensive testing of image | |
8 % denoising. It should only give an idea how SMALL structure can be used | |
9 % for testing. | |
10 | |
2 % | 11 % |
3 % Centre for Digital Music, Queen Mary, University of London. | 12 % Centre for Digital Music, Queen Mary, University of London. |
4 % This file copyright 2010 Ivan Damnjanovic. | 13 % This file copyright 2010 Ivan Damnjanovic. |
5 % | 14 % |
6 % This program is free software; you can redistribute it and/or | 15 % This program is free software; you can redistribute it and/or |
7 % modify it under the terms of the GNU General Public License as | 16 % modify it under the terms of the GNU General Public License as |
8 % published by the Free Software Foundation; either version 2 of the | 17 % published by the Free Software Foundation; either version 2 of the |
9 % License, or (at your option) any later version. See the file | 18 % License, or (at your option) any later version. See the file |
10 % COPYING included with this distribution for more information. | 19 % COPYING included with this distribution for more information. |
11 % | |
12 % This file contains an example of how SMALLbox can be used to test different | |
13 % dictionary learning techniques in Image Denoising problem. | |
14 % This example can be used to test SPAMS for different values of | |
15 % parameter lambda. In no way it represents extensive testing of image | |
16 % denoising. It should only give an idea how SMALL structure can be used | |
17 % for testing. | |
18 % | |
19 %% | 20 %% |
20 | 21 |
21 clear all; | 22 clear all; |
22 | 23 |
23 %% Load an image | 24 %% Load an image |
84 % (backward compatiblity with SPARCO: solver structure communicate | 85 % (backward compatiblity with SPARCO: solver structure communicate |
85 % only with Problem structure, ie no direct communication between DL and | 86 % only with Problem structure, ie no direct communication between DL and |
86 % solver structures) | 87 % solver structures) |
87 | 88 |
88 SMALL.Problem.A = SMALL.DL(1).D; | 89 SMALL.Problem.A = SMALL.DL(1).D; |
89 | 90 SMALL.Problem.reconstruct = @(x) ImgDenoise_reconstruct(x, SMALL.Problem); |
90 | 91 |
91 %% | 92 %% |
92 % Initialising solver structure | 93 % Initialising solver structure |
93 % Setting solver structure fields (toolbox, name, param, solution, | 94 % Setting solver structure fields (toolbox, name, param, solution, |
94 % reconstructed and time) to zero values | 95 % reconstructed and time) to zero values |
95 | 96 |
96 SMALL.solver(1)=SMALL_init_solver; | 97 SMALL.solver(1)=SMALL_init_solver; |
97 | 98 |
98 % Defining the parameters needed for sparse representation | 99 % Defining the parameters needed for image denoising |
99 | 100 Edata=sqrt(prod(SMALL.Problem.blocksize)) * SMALL.Problem.sigma * SMALL.Problem.gain; |
100 SMALL.solver(1).toolbox='ompbox'; | 101 maxatoms = floor(prod(SMALL.Problem.blocksize)/2); |
101 SMALL.solver(1).name='ompdenoise'; | 102 |
102 | 103 SMALL.solver(1).toolbox='ompbox'; |
103 % Denoising the image - SMALL_denoise function is similar to SMALL_solve, | 104 SMALL.solver(1).name='omp2'; |
104 % but backward compatible with KSVD definition of denoising | 105 SMALL.solver(1).param=struct(... |
105 | 106 'epsilon',Edata,... |
106 SMALL.solver(1)=SMALL_denoise(SMALL.Problem, SMALL.solver(1)); | 107 'maxatoms', maxatoms); |
107 | 108 |
109 % Denoising the image - find the sparse solution in the learned | |
110 % dictionary for all patches in the image and the end it uses | |
111 % reconstruction function to reconstruct the patches and put them into a | |
112 % denoised image | |
113 | |
114 SMALL.solver(1)=SMALL_solve(SMALL.Problem, SMALL.solver(1)); | |
108 | 115 |
109 %% show results %% | 116 %% show results %% |
110 % This will show denoised image and dictionary for all lambdas. If you | 117 % This will show denoised image and dictionary for all lambdas. If you |
111 % are not interested to see it and do not want clutter your screen | 118 % are not interested to see it and do not want clutter your screen |
112 % comment following line | 119 % comment following line |