-
Notifications
You must be signed in to change notification settings - Fork 0
/
convertData.m
49 lines (38 loc) · 1.43 KB
/
convertData.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
function sceneDataSet = convertData
%CONVERTDATA Summary of this function goes here
% Detailed explanation goes here
addpath( 'dataset/tracks');
sceneDataSet = cell(72,1);
for i=1:72
tracks = readTracks(['dataset/tracks/track' num2str(i) '.dat']);
maxFrameNum=0;
for t=1:length(tracks)
if maxFrameNum < tracks(t).te
maxFrameNum = tracks(t).te;
end
end
sceneData = cell(maxFrameNum,1);
for t=1:length(tracks)
for f=[tracks(t).ti : tracks(t).te]
switch tracks(t).locs(4,f-tracks(t).ti+1)
case 1
dir = 0;
case 2
dir = pi/2;
case 3
dir = pi;
case 4
dir = 3*pi/2;
end
st = struct( 'id', tracks(t).id, 'bb', tracks(t).bbs(:,f-tracks(t).ti+1), 'loc', tracks(t).locs(1:2,f-tracks(t).ti+1), 'direction', dir );
if isempty( sceneData{f} )
sceneData{f} = st;
else
sceneData{f}(end+1) = st;
end
end
end
sceneDataSet{i} = sceneData;
end
save('sceneDataSet', 'sceneDataSet' );
end