-
Notifications
You must be signed in to change notification settings - Fork 1
/
createNewTracks.m
35 lines (29 loc) · 1.17 KB
/
createNewTracks.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
function [tracks,nextId] = createNewTracks(unassignedDetections,centroids,bboxes,tracks,nextId)
centroids = centroids(unassignedDetections, :);
bboxes = bboxes(unassignedDetections, :);
for i = 1:size(centroids, 1)
centroid = centroids(i,:);
bbox = bboxes(i, :);
% create a Kalman filter object
kalmanFilter = configureKalmanFilter('ConstantVelocity', ...
centroid, [200, 50], [100, 25], 100);
% create a new track
newTrack = struct(...
'id', nextId, ...
'bbox', bbox, ...
'bboxHist', bbox, ...
'xMotion', 0, ...
'yMotion', 0, ...
'currPerson', '',...
'personCount', struct('abc',0),...
'time', now, ...
'kalmanFilter', kalmanFilter, ...
'age', 1, ...
'totalVisibleCount', 1, ...
'consecutiveInvisibleCount', 0);
% add it to the array of tracks
tracks(end + 1) = newTrack;
% increment the next id
nextId = nextId + 1;
end
end