Rev | Line | |
---|
[40] | 1 | % load the data: |
---|
[46] | 2 | %load cells; |
---|
| 3 | load cellscaled; |
---|
[40] | 4 | |
---|
| 5 | % settings: |
---|
| 6 | g_s = [1 2 3 5]; % scale |
---|
| 7 | g_f = [0.1 0.3]; %freq |
---|
| 8 | g_d = [0 0.25 0.5 0.75]*pi; % direction |
---|
| 9 | |
---|
| 10 | % other |
---|
| 11 | ns = length(g_s); |
---|
| 12 | nd = length(g_d); |
---|
| 13 | nf = length(g_f); |
---|
| 14 | |
---|
| 15 | % compute feature for train and test: |
---|
| 16 | dim = ns*nd*nf; |
---|
| 17 | N = size(x,1); |
---|
| 18 | for i=1:N |
---|
| 19 | i |
---|
| 20 | % get image data from green channel: |
---|
| 21 | %im = x{i,1}(:,:,2); |
---|
| 22 | im = sum(x{i,1}(:,:,2),3); |
---|
[46] | 23 | %if (min(im(:))<0) error('pixel values < 0'); end |
---|
[40] | 24 | % im = im/max(im(:)); |
---|
| 25 | im = double(hist_equalize(im)); |
---|
| 26 | %newx: |
---|
| 27 | newx = zeros(size(im,1),size(im,2),dim+1); |
---|
| 28 | newx(:,:,1) = im; |
---|
| 29 | % get gabor features |
---|
| 30 | j=1; |
---|
| 31 | for i1=1:ns |
---|
| 32 | for i2=1:nf |
---|
| 33 | for i3=1:nd |
---|
| 34 | j=j+1; |
---|
| 35 | newx(:,:,j) = abs(gabor(im,g_s(i1),g_f(i2),g_d(i3))); |
---|
| 36 | end |
---|
| 37 | end |
---|
| 38 | end |
---|
| 39 | x{i,1} = newx; |
---|
| 40 | end |
---|
| 41 | M = size(z,1); |
---|
| 42 | for i=1:M |
---|
| 43 | i |
---|
| 44 | % get image data from green channel: |
---|
| 45 | %im = z{i,1}(:,:,2); |
---|
| 46 | im = sum(z{i,1}(:,:,2),3); |
---|
[46] | 47 | %if (min(im(:))<0) error('pixel values < 0'); end |
---|
[40] | 48 | % im = im/max(im(:)); |
---|
| 49 | im = double(hist_equalize(im)); |
---|
| 50 | %newz: |
---|
| 51 | newz = zeros(size(im,1),size(im,2),dim+1); |
---|
| 52 | newz(:,:,1) = im; |
---|
| 53 | % get gabor features |
---|
| 54 | j=1; |
---|
| 55 | for i1=1:ns |
---|
| 56 | for i2=1:nf |
---|
| 57 | for i3=1:nd |
---|
| 58 | j=j+1; |
---|
| 59 | newz(:,:,j) = abs(gabor(im,g_s(i1),g_f(i2),g_d(i3))); |
---|
| 60 | end |
---|
| 61 | end |
---|
| 62 | end |
---|
| 63 | z{i,1} = newz; |
---|
| 64 | end |
---|
| 65 | |
---|
[46] | 66 | save cells_gabor_sc x z; |
---|
Note: See
TracBrowser
for help on using the repository browser.