Documentation

# assignjv

Jonker-Volgenant global nearest neighbor assignment algorithm

## Syntax

``[assignments,unassignedrows,unassignedcolumns] = assignjv(costmatrix,costofnonassignment)``

## Description

example

````[assignments,unassignedrows,unassignedcolumns] = assignjv(costmatrix,costofnonassignment)` returns a table of `assignments` of 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 of `costmatrix` to `Inf` to prohibit an assignment.`costofnonassignment` represents 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.

`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.

```for i = size(tracks,1):-1:1 delta = dets - tracks(i,:); costMatrix(i,:) = sqrt(sum(delta .^ 2,2)); end costofnonassignment = 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') hold on xlim([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');``` 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 an M-by-N matrix. M is the number of tracks to be assigned and N is 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 contain `Inf` entries 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 to `Inf`.

Data Types: `single` | `double`

## Output Arguments

collapse all

Assignment of detections to track, returned as an integer-valued L-by-2 matrix where L is 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-valued P-by-1 column vector.

Data Types: `uint32`

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

Data Types: `uint32`

 Samuel S. Blackman and Popoli, R. Design and Analysis of Modern Tracking Systems. Artech House: Norwood, MA. 1999.
{"ft_lang_label":"__label__en","ft_lang_prob":0.83113885,"math_prob":0.9905761,"size":1689,"snap":"2019-51-2020-05","text_gpt3_token_len":371,"char_repetition_ratio":0.18813056,"word_repetition_ratio":0.03984064,"special_character_ratio":0.18058023,"punctuation_ratio":0.11764706,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.98682773,"pos_list":[0,1,2],"im_url_duplicate_count":[null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-01-18T08:55:58Z\",\"WARC-Record-ID\":\"<urn:uuid:f39ce027-3244-427e-a21a-ab61b0108e4d>\",\"Content-Length\":\"88228\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:080bc206-7acb-4ee6-bd6d-babc07b98394>\",\"WARC-Concurrent-To\":\"<urn:uuid:aed211c7-8e15-4ef4-9eae-b38163023752>\",\"WARC-IP-Address\":\"23.50.112.17\",\"WARC-Target-URI\":\"https://kr.mathworks.com/help/fusion/ref/assignjv.html\",\"WARC-Payload-Digest\":\"sha1:JPGMPM7P4GPWUENV5CYG6J5NB6T57C47\",\"WARC-Block-Digest\":\"sha1:DFM2DGRTMOXWJQOA46RTUVBGXDJHSBB5\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-05/CC-MAIN-2020-05_segments_1579250592394.9_warc_CC-MAIN-20200118081234-20200118105234-00428.warc.gz\"}"}