-
Notifications
You must be signed in to change notification settings - Fork 0
/
ExtractFeatures.m
112 lines (106 loc) · 4.18 KB
/
ExtractFeatures.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
features = zeros(2400000, 771);
index = 1;
dir_perfix = 'data/mat/boxing/';
videos=dir(strcat(dir_perfix,'*.mat'));
file_names = {videos.name};
for i=1 : size(file_names,2)
file_name=strcat(dir_perfix,file_names{i});
video = load(file_name);
video = video.video;
stips = demo_selective_stip(0, video);
HOG3DFeatures = HOG3DAPI(video, stips, power(8/8, 3)*8*64, 8);
HOOFFeatures = HOOFAPI(video, stips, 32, 8);
classLabel = zeros(size(stips, 1), 1) + 1;
fileId = zeros(size(stips, 1), 1) + i;
features(index:index+size(stips, 1)-1, :) = [HOG3DFeatures HOOFFeatures classLabel fileId stips(:, 3)];
index = index + size(stips, 1);
display('boxing');
display(i);
end
dir_perfix = 'data/mat/handclapping/';
videos=dir(strcat(dir_perfix,'*.mat'));
file_names = {videos.name};
for i=1 : size(file_names,2)
file_name=strcat(dir_perfix,file_names{i});
video = load(file_name);
video = video.video;
stips = demo_selective_stip(0, video);
HOG3DFeatures = HOG3DAPI(video, stips, power(8/8, 3)*8*64, 8);
HOOFFeatures = HOOFAPI(video, stips, 32, 8);
classLabel = zeros(size(stips, 1), 1) + 2;
fileId = zeros(size(stips, 1), 1) + i;
features(index:index+size(stips, 1)-1, :) = [HOG3DFeatures HOOFFeatures classLabel fileId stips(:, 3)];
index = index + size(stips, 1);
display('handclapping');
display(i);
end
dir_perfix = 'data/mat/handwaving/';
videos=dir(strcat(dir_perfix,'*.mat'));
file_names = {videos.name};
for i=1 : size(file_names,2)
file_name=strcat(dir_perfix,file_names{i});
video = load(file_name);
video = video.video;
stips = demo_selective_stip(0, video);
HOG3DFeatures = HOG3DAPI(video, stips, power(8/8, 3)*8*64, 8);
HOOFFeatures = HOOFAPI(video, stips, 32, 8);
classLabel = zeros(size(stips, 1), 1) + 3;
fileId = zeros(size(stips, 1), 1) + i;
features(index:index+size(stips, 1)-1, :) = [HOG3DFeatures HOOFFeatures classLabel fileId stips(:, 3)];
index = index + size(stips, 1);
display('handwaving');
display(i);
end
dir_perfix = 'data/mat/jogging/';
videos=dir(strcat(dir_perfix,'*.mat'));
file_names = {videos.name};
for i=1 : size(file_names,2)
file_name=strcat(dir_perfix,file_names{i});
video = load(file_name);
video = video.video;
stips = demo_selective_stip(0, video);
HOG3DFeatures = HOG3DAPI(video, stips, power(8/8, 3)*8*64, 8);
HOOFFeatures = HOOFAPI(video, stips, 32, 8);
classLabel = zeros(size(stips, 1), 1) + 4;
fileId = zeros(size(stips, 1), 1) + i;
features(index:index+size(stips, 1)-1, :) = [HOG3DFeatures HOOFFeatures classLabel fileId stips(:, 3)];
index = index + size(stips, 1);
display('jogging');
display(i);
end
dir_perfix = 'data/mat/running/';
videos=dir(strcat(dir_perfix,'*.mat'));
file_names = {videos.name};
for i=1 : size(file_names,2)
file_name=strcat(dir_perfix,file_names{i});
video = load(file_name);
video = video.video;
stips = demo_selective_stip(0, video);
HOG3DFeatures = HOG3DAPI(video, stips, power(8/8, 3)*8*64, 8);
HOOFFeatures = HOOFAPI(video, stips, 32, 8);
classLabel = zeros(size(stips, 1), 1) + 5;
fileId = zeros(size(stips, 1), 1) + i;
features(index:index+size(stips, 1)-1, :) = [HOG3DFeatures HOOFFeatures classLabel fileId stips(:, 3)];
index = index + size(stips, 1);
display('running');
display(i);
end
dir_perfix = 'data/mat/walking/';
videos=dir(strcat(dir_perfix,'*.mat'));
file_names = {videos.name};
for i=1 : size(file_names,2)
file_name=strcat(dir_perfix,file_names{i});
video = load(file_name);
video = video.video;
stips = demo_selective_stip(0, video);
HOG3DFeatures = HOG3DAPI(video, stips, power(8/8, 3)*8*64, 8);
HOOFFeatures = HOOFAPI(video, stips, 32, 8);
classLabel = zeros(size(stips, 1), 1) + 6;
fileId = zeros(size(stips, 1), 1) + i;
features(index:index+size(stips, 1)-1, :) = [HOG3DFeatures HOOFFeatures classLabel fileId stips(:, 3)];
index = index + size(stips, 1);
display('walking');
display(i);
end
features(index:end, :) = [];
save('data/features/features.mat', 'features', '-v7.3');