Mercurial > hg > smallbox
comparison Problems/Pierre_Problem.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 |
comparison
equal
deleted
inserted
replaced
121:5ded5e2e7d07 | 126:db5a7fe1a404 |
---|---|
1 function data=Pierre_Problem(src, trg, blocksize, dictsize); | 1 function data=Pierre_Problem(src, trg, blocksize, dictsize); |
2 %%% Generate Pierre Problem | 2 %% Generate Pierre 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 % Pierre_Problem is a part of the SMALLbox and generates the problem | 4 % Pierre_Problem is a part of the SMALLbox and generates the problem |
14 % suggested by Professor Pierre Vandergheynst on the SMALL meeting in | 5 % suggested by Professor Pierre Vandergheynst on the SMALL meeting in |
15 % Villars. | 6 % Villars. |
16 % The function takes as an input: | 7 % The function takes as an input: |
36 % - blocksize - block size (default [5 5]), | 27 % - blocksize - block size (default [5 5]), |
37 % - maxval - maximum value (default - 255) | 28 % - maxval - maximum value (default - 255) |
38 % - sparse - if 1 SMALL_solve will keep solution matrix in sparse form, | 29 % - sparse - if 1 SMALL_solve will keep solution matrix in sparse form, |
39 % due to memory constrains. | 30 % due to memory constrains. |
40 | 31 |
32 % | |
33 % Centre for Digital Music, Queen Mary, University of London. | |
34 % This file copyright 2010 Ivan Damnjanovic. | |
35 % | |
36 % This program is free software; you can redistribute it and/or | |
37 % modify it under the terms of the GNU General Public License as | |
38 % published by the Free Software Foundation; either version 2 of the | |
39 % License, or (at your option) any later version. See the file | |
40 % COPYING included with this distribution for more information. | |
41 %% prompt user for images %% | 41 %% prompt user for images %% |
42 | 42 |
43 % ask for source file name | 43 % ask for source file name |
44 | 44 |
45 TMPpath=pwd; | 45 TMPpath=pwd; |
89 blocksize = ones(1,p)*blocksize; | 89 blocksize = ones(1,p)*blocksize; |
90 end | 90 end |
91 %% | 91 %% |
92 %% create dictionary data %% | 92 %% create dictionary data %% |
93 | 93 |
94 S=im2col(src,blocksize,'sliding'); | 94 S=im2colstep(src,blocksize); |
95 | 95 |
96 for j= 1:size(S,2) | 96 for j= 1:size(S,2) |
97 S(:,j)=S(:,j)./norm(S(:,j)); | 97 S(:,j)=S(:,j)./norm(S(:,j)); |
98 end | 98 end |
99 | 99 |
100 %% create measurement matrix %% | 100 %% create measurement matrix %% |
101 | 101 |
102 T=im2col(trg,blocksize, 'distinct'); | 102 T=im2colstep(trg,blocksize, blocksize); |
103 | 103 |
104 %% output structure %% | 104 %% output structure %% |
105 | 105 |
106 data.imageSrc = src; | 106 data.imageSrc = src; |
107 data.imageTrg = trg; | 107 data.imageTrg = trg; |