-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmultiObjectTrackingDebug.m
30 lines (23 loc) · 1.02 KB
/
multiObjectTrackingDebug.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
function multiObjectTrackingDebug()
debug=true;
[vid,detect,blob,colorVid,maskVid] = setupSystemObjects(debug);
tracks = initializeTracks(); % create an empty array of tracks
nextId = 1; % ID of the next track
% detect moving objects, and track them across video frames
try
while ~isDone(vid.reader)
frame = vid.reader.step();
[centroids, bboxes, mask, detect, blob] = detectObjects(frame,detect,blob);
tracks = predictNewLocationsOfTracks(tracks);
[assignments, unassignedTracks, unassignedDetections] = ...
detectionToTrackAssignment(tracks,centroids);
tracks = updateAssignedTracks(assignments,centroids,bboxes,tracks);
tracks = updateUnassignedTracks(unassignedTracks,tracks);
tracks = deleteLostTracks(tracks);
[tracks,nextId] = createNewTracks(unassignedDetections,centroids,bboxes,tracks,nextId);
displayTrackingResults(frame,mask,tracks,vid,colorVid,maskVid,debug);
drawnow;
end
catch err
rethrow(err);
end