-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomputeDescriptors.m
84 lines (59 loc) · 3.11 KB
/
computeDescriptors.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
function [] = computeDescriptors(params)
% COMPUTEDESCRIPTORS is a function that selects the descriptors that are going to be
% computed on the visual paths dataset.
% Authors: Jose Rivera-Rubio and Ioannis Alexiou
% {jose.rivera,ia2109}@imperial.ac.uk
%
% Initial version: April, 2014
% Last Modified: Otober, 2015
% Other global variables
descrFnameStr = 'C%dP%d';
% MAIN LOOP
for corr = params.corridors
corridor = ['C' num2str(corr)];
%h = waitbar(0,'Processing passes...');
for p = params.passes
pass = ['P' num2str(p)];
workingPath = fullfile(params.datasetDir,corridor,'videos',num2str(p));
framesDir = fullfile(workingPath,params.frameDir,filesep);
writepath = fullfile(params.descrDir,...
params.descriptor,corridor,pass,filesep);
% Create descriptor writepath if it doesn't exist
mkdir(writepath);
descrFname = sprintf(descrFnameStr,corr,p);
descrSavePath = [writepath descrFname '_Descriptors'];
if (~exist([descrSavePath '.mat'], 'file') || params.debug)
switch params.descriptor
case 'LW_COLOR' % Case of Lightweight color descriptors
LW_COLOR(framesDir, descrSavePath);
case 'CRBML1' % Case of CRBML1
L1_CRBM(framesDir, descrSavePath);
case 'SF_GABOR' % Case of single-frame Gabor
SF_GABOR(framesDir, descrSavePath);
case 'SIFT' % case of Sparse-SIFT based on keypoint detection
SIFT(framesDir, descrSavePath);
case 'DSIFT' % case of Dense-SIFT
DSIFT(framesDir, descrSavePath);
case 'ST_GABOR' % Case of spatio-temporal Gabors
gradientsFname = [descrFname '_gradients'];
% Generate the gradients
[descProps] = ST_GABOR(framesDir, gradientsFname, writepath);
% Construct the descriptor
ST_descriptor_construction(gradientsFname, descrSavePath, writepath, descProps);
case 'ST_GAUSS' % Case of spatio-temporal Gaussians
gradientsFname = [descrFname '_gradients'];
% Generate the gradients
[descProps] = ST_GAUSS(framesDir, gradientsFname, writepath);
% Construct the descriptor
ST_descriptor_construction(gradientsFname, descrSavePath, writepath, descProps);
end
disp(['Finished encoding pass ' pass]);
else
disp('Descriptor already exists');
end
disp('Descriptor created');
end
fprintf('Finished computing descriptors %s for corridor %s.\n', params.descriptor, num2str(corr));
%close(h);
end
end