forked from jyi2/KCF-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.m
42 lines (39 loc) · 1.35 KB
/
main.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
% the main.m calls the internface RUN_TRACKER to perform tracking on%
% the videos provided in the tacker.txt
% Jianyi Yi, 2015
%% open tracker.txt and load its content
parent = 'D:\ROSE\videos\videoRetrieval\videoRetrieval';
tracker = strcat(parent, '/rvp_init_boxes/', 'tracker1.txt');
f = fopen(tracker);
assert(f ~= -1, ['No videos to load ("' tracker '").'])
try
videos = textscan(f, '%s', 'ReturnOnError',false);
catch %#ok, try different format (no commas)
frewind(f);
videos = textscan(f, '%s');
end
videos = cat(2, videos{:});
fclose(f);
%display(videos);
%% split tacker.txt contents to base_path and videoName and frame number
% e.g. 'D:\ROSE\videos\videoRetrieval\videoRetrieval\others\100plus6/76.jpg' to
% 'D:\ROSE\videos\videoRetrieval\videoRetrieval\others', '100plus6' and '76'
num = size(videos);
video_list = cell(num, 3);
expr1 = '\\';
expr2 = '\\[\w\.]+/';
expr3 = '\d+.jpg';
for i=1:num
str = videos{i};
startIndex = regexp(str, expr1);
temp = str(1: startIndex-1);
video_list{i, 1} = [parent '\videos\' temp];
[startIndex, endIndex] = regexp(str, expr2);
video_list{i, 2} = str(startIndex+1: endIndex-1);
[startIndex, endIndex] = regexp(str, expr3);
video_list{i, 3} = str(startIndex: endIndex-4);
start_pos = str2num(video_list{i, 3});
%video_list{i,1}
disp(videos{i});
run_tracker(start_pos, video_list{i,1},video_list{i,2});
end