Mercurial > hg > smallbox
comparison Problems/generateImageDenoiseProblem.m @ 126:db5a7fe1a404 ivand_dev
Merge from branch "sup_158_IMG_Processing_toolbox_"
author | Ivan Damnjanovic lnx <ivan.damnjanovic@eecs.qmul.ac.uk> |
---|---|
date | Wed, 25 May 2011 15:30:34 +0100 |
parents | 002ec1b2ceff |
children | 8e660fd14774 |
comparison
equal
deleted
inserted
replaced
121:5ded5e2e7d07 | 126:db5a7fe1a404 |
---|---|
1 function data=generateImageDenoiseProblem(im, trainnum, blocksize, dictsize, sigma, gain, maxval, initdict); | 1 function data=generateImageDenoiseProblem(im, trainnum, blocksize, dictsize, sigma, gain, maxval, initdict); |
2 %%% Generate Image Denoising Problem | 2 %% Generate Image Denoising Problem |
3 % | |
4 % Centre for Digital Music, Queen Mary, University of London. | |
5 % This file copyright 2010 Ivan Damnjanovic. | |
6 % | |
7 % This program is free software; you can redistribute it and/or | |
8 % modify it under the terms of the GNU General Public License as | |
9 % published by the Free Software Foundation; either version 2 of the | |
10 % License, or (at your option) any later version. See the file | |
11 % COPYING included with this distribution for more information. | |
12 % | 3 % |
13 % generateImageDenoiseProblem is a part of the SMALLbox and generates | 4 % generateImageDenoiseProblem is a part of the SMALLbox and generates |
14 % a problem that can be used for comparison of Dictionary Learning/Sparse | 5 % a problem that can be used for comparison of Dictionary Learning/Sparse |
15 % Representation techniques in image denoising scenario. | 6 % Representation techniques in image denoising scenario. |
16 % The function takes as an input: | 7 % The function takes as an input: |
37 % - sigma - noise level, | 28 % - sigma - noise level, |
38 % - noise gain (default - 1.15), | 29 % - noise gain (default - 1.15), |
39 % - maxval - maximum value (default - 255) | 30 % - maxval - maximum value (default - 255) |
40 % - initdict - initial dictionary (default - 4x overcomlete dct) | 31 % - initdict - initial dictionary (default - 4x overcomlete dct) |
41 % - signalDim - signal dimension (default - 2) | 32 % - signalDim - signal dimension (default - 2) |
33 | |
34 % | |
35 % Centre for Digital Music, Queen Mary, University of London. | |
36 % This file copyright 2010 Ivan Damnjanovic. | |
37 % | |
38 % This program is free software; you can redistribute it and/or | |
39 % modify it under the terms of the GNU General Public License as | |
40 % published by the Free Software Foundation; either version 2 of the | |
41 % License, or (at your option) any later version. See the file | |
42 % COPYING included with this distribution for more information. | |
42 % | 43 % |
43 % Based on KSVD denoise demo by Ron Rubinstein | 44 % Based on KSVD denoise demo by Ron Rubinstein |
44 % See also KSVDDENOISEDEMO and KSVDDEMO. | 45 % See also KSVDDENOISEDEMO and KSVDDEMO. |
45 % Ron Rubinstein | 46 % Ron Rubinstein |
46 % Computer Science Department | 47 % Computer Science Department |
134 blockids = i : min(i+bsize-1,size(X,2)); | 135 blockids = i : min(i+bsize-1,size(X,2)); |
135 X(:,blockids) = remove_dc(X(:,blockids),'columns'); | 136 X(:,blockids) = remove_dc(X(:,blockids),'columns'); |
136 end | 137 end |
137 | 138 |
138 % Noisy image blocks | 139 % Noisy image blocks |
139 xcol=im2col(x,blocksize,'sliding'); | 140 xcol=im2colstep(x,blocksize); |
140 [b1, dc] = remove_dc(xcol,'columns'); | 141 [b1, dc] = remove_dc(xcol,'columns'); |
141 | 142 |
142 %% output structure %% | 143 %% output structure %% |
143 | 144 |
144 data.Original = im; | 145 data.Original = im; |