-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeature_extraction_compression.m
92 lines (71 loc) · 2.25 KB
/
feature_extraction_compression.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
%Script for feature extraction, compression and storing the extracted features in csv files
addpath(genpath('code\third_party\segmentationBerkeley\lib\matlab'));
type='color';
datatype='train';
[iids] = imgList(datatype);
% Compute Texture Gradiant
no = 6;
ss = 1;
ns = 2;
sc = sqrt(2);
el = 2;
k = 64;
fname = sprintf( ...
'unitex_%.2g_%.2g_%.2g_%.2g_%.2g_%d.mat',no,ss,ns,sc,el,k);
load(fname); % defines fb,tex,tsim
for i=1:length(iids)
pb=pbHuman(type,iids(i));
pb=imresize(pb,[107,160]);
pb_h(:,i)=reshape(pb,107*160,1);
end;
csvwrite(strcat('compressed/',type,'/',datatype,'/human.csv'),pb_h');
clear pb_h;
for i=1:length(iids)
im=imgRead(iids(i),type);
[pb_BG,thetaBG] = pbBG(im);
pb_BG=imresize(pb_BG,[107,160]);
pb_h(:,i)=reshape(pb_BG,107*160,1);
end;
csvwrite(strcat('compressed/',type,'/',datatype,'/BG.csv'),pb_h');
for i=1:length(iids)
im=imgRead(iids(i),type);
[pb_TG,thetaTG] = pbTG(im,0.02,8,tex);
pb_TG=imresize(pb_TG,[107,160]);
pb_h(:,i)=reshape(pb_TG,107*160,1);
end;
csvwrite(strcat('compressed/',type,'/',datatype,'/TG.csv'),pb_h');
for i=1:length(iids)
im=imgRead(iids(i),type);
[pb_CG,thetaCG] = pbCG(im);
pb_CG=imresize(pb_CG,[107,160]);
pb_h(:,i)=reshape(pb_CG,107*160,1);
end;
csvwrite(strcat('compressed/',type,'/',datatype,'/CG.csv'),pb_h');
%
% for i=1:length(iids)
% im=imgRead(iids(i),type);
% [pb_CGTG,thetaCGTG] = pbCGTG(im,[0.01 0.02 0.02 0.02],8,tex);
% pb_h(:,i)=reshape(pb_CGTG,321*481,1);
% end;
% csvwrite(strcat(type,'/',datatype,'/CGTG.csv'),pb_h');
for i=1:length(iids)
im=imgRead(iids(i),type);
[pb_Canny] = pbCanny(im);
pb_Canny=imresize(pb_Canny,[107,160]);
pb_h(:,i)=reshape(pb_Canny,107*160,1);
end;
csvwrite(strcat('compressed/',type,'/',datatype,'/Canny.csv'),pb_h');
for i=1:length(iids)
im=imgRead(iids(i),type);
[pb_MM] = pb2MM(im);
pb_MM=imresize(pb_MM,[107,160]);
pb_h(:,i)=reshape(pb_MM,107*160,1);
end;
csvwrite(strcat('compressed/',type,'/',datatype,'/2MM.csv'),pb_h');
for i=1:length(iids)
im=imgRead(iids(i),type);
[pb_MM2] = pb2MM2(im);
pb_MM2=imresize(pb_MM2,[107,160]);
pb_h(:,i)=reshape(pb_MM2,107*160,1);
end;
csvwrite(strcat('compressed/',type,'/',datatype,'/2MM2.csv'),pb_h');