-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathdetectionToTrackAssignment.m
More file actions
26 lines (25 loc) · 979 Bytes
/
Copy pathdetectionToTrackAssignment.m
File metadata and controls
26 lines (25 loc) · 979 Bytes
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
% function [assignments, unassignedTracks, unassignedDetections] = ...
% detectionToTrackAssignment(centroids)
% compute an assignment which minimizes the total cost
% Inputs:
% centroids: array
% Outputs:
% assignments: array
% unassignedTracks: array
% unassignedDetections: array
function [assignments, unassignedTracks, unassignedDetections] = ...
detectionToTrackAssignment(centroids)
global obj;
global tracks;
nTracks = length(tracks);
nDetections = size(centroids, 1);
% Compute the cost of assigning each detection to each track.
cost = zeros(nTracks, nDetections);
for i = 1:nTracks
cost(i, :) = distance(mean(tracks(i).particles), centroids);
end
% Solve the assignment problem.
costOfNonAssignment = 20;
[assignments, unassignedTracks, unassignedDetections] = ...
assignDetectionsToTracks(cost, costOfNonAssignment);
end