Main Content

assignjv

Jonker-Volgenant global nearest neighbor assignment algorithm

Description

example

[assignments,unassignedrows,unassignedcolumns] = assignjv(costmatrix,costofnonassignment)returns a table ofassignmentsof detections to tracks using the Jonker-Volgenant algorithm. The JV algorithm finds an optimal solution to the global nearest neighbor (GNN) assignment problem by finding the set of assignments that minimize the total cost of the assignments. The Jonker-Volgenant algorithm solves the GNN assignment in two phases: begin with the auction algorithm and end with the Dijkstra shortest path algorithm.

The cost of each potential assignment is contained in the cost matrix,costmatrix. Each matrix entry represents the cost of a possible assignments. Matrix rows represent tracks and columns represent detections. All possible assignments are represented in the cost matrix. The lower the cost, the more likely the assignment is to be made. Each track can be assigned to at most one detection and each detection can be assigned to at most one track. If the number of rows is greater than the number of columns, some tracks are unassigned. If the number of columns is greater than the number of rows, some detections are unassigned. You can set an entry ofcostmatrixtoInfto prohibit an assignment.

costofnonassignmentrepresents the cost of leaving tracks or detections unassigned. Higher values increase the likelihood that every existing object is assigned.

The function returns a list of unassigned tracks,unassignedrows, and a list of unassigned detections,unassignedcolumns.

Examples

collapse all

Use assignjv to assign three detections to two tracks.

Start with two predicted track locations in x-y coordinates.

tracks = [1,1; 2,2];

Assume three detections are received. At least one detection will not be assigned.

dets = [1.1, 1.1; 2.1, 2.1; 1.5, 3];

Construct a cost matrix by defining the cost of assigning a detection to a track as the Euclidean distance between them. Set the cost of non-assignment to 0.2.

fori = size(tracks,1):-1:1 delta = dets - tracks(i,:); costMatrix(i,:) = sqrt(sum(delta .^ 2,2));endcostofnonassignment = 0.2;

Use the Auction algorithm to assign detections to tracks.

[assignments, unassignedTracks, unassignedDetections] =...assignjv(costMatrix,costofnonassignment);

Display the assignments.

disp(assignments)
1 1 2 2

Show that there are no unassigned tracks.

disp(unassignedTracks)

Display the unassigned detections.

disp(unassignedDetections)
3

Plot the detection to track assignments.

plot(tracks(:, 1), tracks(:, 2),'*', dets(:, 1), dets(:, 2),'o') holdonxlim([0,4]) ylim([0,4]) legend('tracks','detections') assignStr = strsplit(num2str(1:size(assignments,1))); text(tracks(assignments(:,1),1) + 0.1,...tracks(assignments(:,1),2) - 0.1, assignStr); text(dets(assignments(:,2),1) + 0.1,...dets(assignments(:,2),2) - 0.1, assignStr); text(dets(unassignedDetections(:),1) + 0.1,...dets(unassignedDetections(:),2) + 0.1,'unassigned');

Figure contains an axes object. The axes object contains 7 objects of type line, text. These objects represent tracks, detections.

The track to detection assignments are:

  1. Detection 1 is assigned to track 1.

  2. Detection 2 is assigned to track 2.

  3. Detection 3 is not assigned.

Input Arguments

collapse all

Cost matrix, specified as anM-by-Nmatrix.Mis the number of tracks to be assigned andNis the number of detections to be assigned. Each entry in the cost matrix contains the cost of a track and detection assignment. The matrix may containInfentries to indicate that an assignment is prohibited. The cost matrix cannot be a sparse matrix.

Data Types:single|double

Cost of non-assignment, specified as a scalar. The cost of non-assignment represents the cost of leaving tracks or detections unassigned. Higher values increase the likelihood that every object is assigned. The value cannot be set toInf.

Data Types:single|double

Output Arguments

collapse all

Assignment of detections to track, returned as an integer-valuedL-by-2 matrix whereLis the number of assignments. The first column of the matrix contains the assigned track indices and the second column contains the assigned detection indices.

Data Types:uint32

Indices of unassigned tracks, returned as an integer-valuedP-by-1 column vector.

Data Types:uint32

Indices of unassigned detections, returned as an integer-valuedQ-by-1 column vector.

Data Types:uint32

References

[1] Samuel S. Blackman and Popoli, R.Design and Analysis of Modern Tracking Systems. Artech House: Norwood, MA. 1999.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

版本历史

Introduced in R2018b