Main Content

getHistory

Get branch history of maintained tracks

Description

example

history = getHistory(branchHistoryMgr) returns a table containing the track branch history maintained by the input trackBranchHistory System object™, branchHistoryMgr.

history = getHistory(branchHistoryMgr,format) returns the branch history in the specified format: 'table' or 'matrix'.

Examples

collapse all

Apply the results of an assignment algorithm to a track-oriented, multi-hypothesis tracking (MHT) branch history manager. View the resulting track branches (hypotheses).

Create the MHT branch history manager, which is a trackBranchHistory System object™. Set the object to maintain a history of four sensors and two scans.

branchHistoryMgr = trackBranchHistory('MaxNumSensors',4,'MaxNumHistoryScans',2)
branchHistoryMgr = 
  trackBranchHistory with properties:

          MaxNumSensors: 4
     MaxNumHistoryScans: 2
           MaxNumTracks: 200
    MaxNumTrackBranches: 3

Update the branch history. Because the first update has no previous branches, the branch history manager contains only unassigned detections.

emptyAssignment = zeros(0,2,'uint32');
emptyUnassignment = zeros(0,1,'uint32');
unassignedDetections = uint32([1;2;3]);
originatingSensor = [1 1 2];
history = branchHistoryMgr(emptyAssignment,emptyUnassignment, ...
    unassignedDetections,originatingSensor);

View the current branch history by using the getHistory function. Each detection is assigned to a separate track.

getHistory(branchHistoryMgr)
ans=3×5 table
    TrackID    ParentID    BranchID                     Scan2                                       Scan1                  
                                       Sensor1    Sensor2    Sensor3    Sensor4    Sensor1    Sensor2    Sensor3    Sensor4
    _______    ________    ________    ________________________________________    ________________________________________

       1          0           1           1          0          0          0          0          0          0          0   
       2          0           2           2          0          0          0          0          0          0          0   
       3          0           3           0          3          0          0          0          0          0          0   

Specify multiple branch assignments and multiple unassigned track branches and detections.

  • Assign branch 1 to detections 1 and 2.

  • Assign branch 2 to detections 1 and 2.

  • Consider track branches 1 and 3 unassigned.

  • Consider detections 1, 2, and 3 unassigned.

assignments = uint32([1 1; 1 2; 2 1; 2 2]);
unassignedTracks = uint32([1;3]);
unassignedDetections = uint32([1;2;3]);

Update the branch history manager with the assignments and unassigned tracks and detections.

history = branchHistoryMgr(assignments,unassignedTracks, ...
    unassignedDetections,originatingSensor);

View the updated branch history.

getHistory(branchHistoryMgr)
ans=9×5 table
    TrackID    ParentID    BranchID                     Scan2                                       Scan1                  
                                       Sensor1    Sensor2    Sensor3    Sensor4    Sensor1    Sensor2    Sensor3    Sensor4
    _______    ________    ________    ________________________________________    ________________________________________

       1          1            1          0          0          0          0          1          0          0          0   
       3          3            3          0          0          0          0          0          3          0          0   
       4          0            4          1          0          0          0          0          0          0          0   
       5          0            5          2          0          0          0          0          0          0          0   
       6          0            6          0          3          0          0          0          0          0          0   
       1          1            7          1          0          0          0          1          0          0          0   
       1          1            8          2          0          0          0          1          0          0          0   
       2          2            9          1          0          0          0          2          0          0          0   
       2          2           10          2          0          0          0          2          0          0          0   

Inspect the branch history.

  • The most recent scan is Scan 2. The previous scan is Scan 1, which was Scan 2 in the previous assignment update. The history has shifted one scan to the right.

  • Branches 1 and 3 are the branches for the unassigned tracks.

  • Branch 2 is no longer in the history because it was not considered to be unassigned. Its assignment to detections 1 and 2 created branches 9 and 10.

  • Branches 4–6 are branches created for the unassigned detections.

  • Branches 7–10 are branches created for the track assignments.

Input Arguments

collapse all

Input branch history manager, specified as a trackBranchHistory System object.

Format of the output branch history, specified as one of the following:

  • 'table' (default) — Return branch history in a table.

  • 'matrix' — Return branch history in a matrix. This output is equivalent to the output returned when calling the trackBranchHistory System object.

Output Arguments

collapse all

Branch history, returned as a table of integers or as a matrix of integers.

Each row of history represents a unique track branch. history has 3+(D×S) columns, where D is the number of maintained scans (the history depth) and S is the maximum number of maintained sensors. The first three columns represent the following information about each track branch:

  • TrackID — ID of the track that is associated with the branch. Track branches that are assumed to have originated from the same target have the same track ID. If a branch originates from an unassigned detection, that branch gets a new track ID.

  • ParentID — ID of the parent branch, that is, the branch from which the current branch originated. Branches that were created from the same parent have the same ParentID. A ParentID of 0 indicates a new track. These tracks are created from hypotheses corresponding to unassigned detections.

  • BranchID — Unique ID of track branch. Every branch created from an unassigned detection or assignment gets a new branch ID.

The remaining D×S columns contain the IDs of the detections assigned to each branch. A branch can be assigned to at most one detection per scan and per sensor. The table shows the organization of these columns with sample detections. N is the number of scans. A value of 0 means that the sensor at that scan does not have a detection assigned to it.

Scan NScan N – 1. . .Scan ND
Sensor – 1Sensor – 2. . .Sensor – S Sensor – 1Sensor – 2. . .Sensor – S . . .Sensor – 1Sensor – 2. . .Sensor – S

1

0

...

0

1

2

...

0

...

0

0

...

0

Introduced in R2018b