-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tracking.m
38 lines (25 loc) · 1017 Bytes
/
Tracking.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
mov=VideoReader('data/video1.avi');
totalframes=mov.NumberOfFrames;
frame_rate=mov.FrameRate;
obj = setupSystemObjects('data/cheng2_mask.avi');
tracks = initializeTracks(); % create an empty array of tracks
i=1;
nextId = 1; % ID of the next track
TTrack =[];
% for z=1:totalframes
% readFrame(obj);
% end
for j=1:totalframes
frame = readFrame(obj);
[areas, centroids, bboxes, mask] = detectObjects(frame,obj);
tracks=predictNewLocationsOfTracks(tracks);
[assignments, unassignedTracks, unassignedDetections] = ...
detectionToTrackAssignment(centroids,tracks);
tracks= updateAssignedTracks(assignments,centroids,bboxes,areas,tracks,mask);
tracks=updateUnassignedTracks(unassignedTracks,tracks,mask);
tracks=deleteLostTracks(tracks);
[tracks,nextId]=createNewTracks(unassignedDetections,centroids,bboxes,areas,nextId,tracks,mask);
TTrack{i}=tracks;
i=i+1;
displayTrackingResults(obj,frame,mask,tracks);
end