-
Notifications
You must be signed in to change notification settings - Fork 10
/
extractingFlow.m
31 lines (28 loc) · 1.05 KB
/
extractingFlow.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
%% UCF101 dataset
addpath( genpath( '../Code' ) )
datasetFolder = '/home/tranlaman/Public/data/video/UCF101_img/';
outFolder = '/home/tranlaman/Public/data/video/UCF101_flow';
%% get classes of segmentation of first split.
params.infopath = '/home/tranlaman/Public/data/video/UCF101/ucfTrainTestlist';
fid = fopen(fullfile(params.infopath, 'classInd.txt'), 'r');
actions = textscan(fid, '%*d %s');
actions = actions{1};
fclose(fid);
l = length(actions);
assert(l == 101, 'BoW_main something wrong with reading classes files');
%% extract flow
for ind = 1:length(actions)
d = dir(fullfile(datasetFolder, actions{ind}));
videoFiles = {d(:).name}';
videoFiles(ismember(videoFiles, {'.','..'})) = [];
for i = 1:length(videoFiles)
vidPath = fullfile(datasetFolder, actions{ind}, videoFiles{i});
flowSavePath = fullfile(outFolder, actions{ind}, videoFiles{i});
if ~exist(flowSavePath, 'dir')
mkdir(flowSavePath);
else
continue;
end
extractFlowVideo(vidPath, flowSavePath);
end
end