comparison examples/Image Denoising/SMALL_ImgDenoise_DL_test_KSVDvsSPAMS.m @ 13:cd55209c69e1

(none)
author idamnjanovic
date Thu, 25 Mar 2010 14:02:09 +0000
parents f72603404233
children cbf3521c25eb
comparison
equal deleted inserted replaced
12:b6d8f2c4f5fa 13:cd55209c69e1
164 % Pay attention that since implicit base dictionary is used, denoising 164 % Pay attention that since implicit base dictionary is used, denoising
165 % can be much faster then using explicit dictionary in KSVD example. 165 % can be much faster then using explicit dictionary in KSVD example.
166 166
167 SMALL.solver(2)=SMALL_denoise(SMALL.Problem, SMALL.solver(2)); 167 SMALL.solver(2)=SMALL_denoise(SMALL.Problem, SMALL.solver(2));
168 168
169 %% 169 % %%
170 % Use SPAMS Online Dictionary Learning Algorithm 170 % % Use SPAMS Online Dictionary Learning Algorithm
171 % to Learn overcomplete dictionary (Julien Mairal 2009) 171 % % to Learn overcomplete dictionary (Julien Mairal 2009)
172 % (If you have not installed SPAMS please comment the following two cells) 172 % % (If you have not installed SPAMS please comment the following two cells)
173 173 %
174 % Initialising Dictionary structure 174 % % Initialising Dictionary structure
175 % Setting Dictionary structure fields (toolbox, name, param, D and time) 175 % % Setting Dictionary structure fields (toolbox, name, param, D and time)
176 % to zero values 176 % % to zero values
177 177 %
178 SMALL.DL(3)=SMALL_init_DL(); 178 % SMALL.DL(3)=SMALL_init_DL();
179 179 %
180 % Defining fields needed for dictionary learning 180 % % Defining fields needed for dictionary learning
181 181 %
182 SMALL.DL(3).toolbox = 'SPAMS'; 182 % SMALL.DL(3).toolbox = 'SPAMS';
183 SMALL.DL(3).name = 'mexTrainDL'; 183 % SMALL.DL(3).name = 'mexTrainDL';
184 184 %
185 % Type 'help mexTrainDL in MATLAB prompt for explanation of parameters. 185 % % Type 'help mexTrainDL in MATLAB prompt for explanation of parameters.
186 186 %
187 SMALL.DL(3).param=struct(... 187 % SMALL.DL(3).param=struct(...
188 'D', SMALL.Problem.initdict,... 188 % 'D', SMALL.Problem.initdict,...
189 'K', SMALL.Problem.p,... 189 % 'K', SMALL.Problem.p,...
190 'lambda', 2,... 190 % 'lambda', 2,...
191 'iter', 200,... 191 % 'iter', 200,...
192 'mode', 3, ... 192 % 'mode', 3, ...
193 'modeD', 0); 193 % 'modeD', 0);
194 194 %
195 % Learn the dictionary 195 % % Learn the dictionary
196 196 %
197 SMALL.DL(3) = SMALL_learn(SMALL.Problem, SMALL.DL(3)); 197 % SMALL.DL(3) = SMALL_learn(SMALL.Problem, SMALL.DL(3));
198 198 %
199 % Set SMALL.Problem.A dictionary 199 % % Set SMALL.Problem.A dictionary
200 % (backward compatiblity with SPARCO: solver structure communicate 200 % % (backward compatiblity with SPARCO: solver structure communicate
201 % only with Problem structure, ie no direct communication between DL and 201 % % only with Problem structure, ie no direct communication between DL and
202 % solver structures) 202 % % solver structures)
203 203 %
204 SMALL.Problem.A = SMALL.DL(3).D; 204 % SMALL.Problem.A = SMALL.DL(3).D;
205 205 %
206 206 %
207 %% 207 % %%
208 % Initialising solver structure 208 % % Initialising solver structure
209 % Setting solver structure fields (toolbox, name, param, solution, 209 % % Setting solver structure fields (toolbox, name, param, solution,
210 % reconstructed and time) to zero values 210 % % reconstructed and time) to zero values
211 211 %
212 SMALL.solver(3)=SMALL_init_solver; 212 % SMALL.solver(3)=SMALL_init_solver;
213 213 %
214 % Defining the parameters needed for denoising 214 % % Defining the parameters needed for denoising
215 215 %
216 SMALL.solver(3).toolbox='ompbox'; 216 % SMALL.solver(3).toolbox='ompbox';
217 SMALL.solver(3).name='ompdenoise'; 217 % SMALL.solver(3).name='ompdenoise';
218 218 %
219 % Denoising the image - SMALL_denoise function is similar to SMALL_solve, 219 % % Denoising the image - SMALL_denoise function is similar to SMALL_solve,
220 % but backward compatible with KSVD definition of denoising 220 % % but backward compatible with KSVD definition of denoising
221 221 %
222 SMALL.solver(3)=SMALL_denoise(SMALL.Problem, SMALL.solver(3)); 222 % SMALL.solver(3)=SMALL_denoise(SMALL.Problem, SMALL.solver(3));
223 223
224 %% 224 %%
225 % Plot results and save midi files 225 % Plot results and save midi files
226 226
227 % show results % 227 % show results %