Main Content


Track-oriented MHT branching and branch history


The trackBranchHistory System object™ is a track-oriented, multi-hypothesis tracking (MHT) branch history manager. The object maintains a history of track branches (hypotheses) that are based on the results of an assignment algorithm, such as the algorithm used by the assignTOMHT function. Given the most recent scan of a set of sensors, the assignment algorithm results include:

  • The assignments of sensor detections to specific track branches

  • The unassigned track branches

  • The unassigned detections

The trackBranchHistory object creates, updates, and deletes track branches as needed and maintains the track branch history for a specified number of scans. Each track and branch stored in the object has a unique ID. To view a table of track branches for the current history, use the getHistory function. To compute branch clusters and incompatible branches, specify the track branch history as an input to the clusterTrackBranches function.

To create a branch history manager and update the branch history:

  1. Create the trackBranchHistory object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?



branchHistoryMgr = trackBranchHistory creates a trackBranchHistory System object, branchHistoryMgr, with default property values.


branchHistoryMgr = trackBranchHistory(Name,Value) sets properties for the trackBranchHistory object by using one or more name-value pairs. For example, branchHistoryMgr = trackBranchHistory('MaxNumTracks',250,'MaxNumTrackBranches',5) creates a trackBranchHistory object that can maintain a maximum of 250 tracks and 5 track branches per track. Enclose property names in quotes. Specified property values can be any numeric data type, but they must all be of the same data type.


expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

Maximum number of sensors, specified as a positive integer.

Maximum number of scans maintained in the branch history, specified as a positive integer. Typical values are from 2 to 6. Higher values increase the computational load.

Maximum number of tracks that the branch history manager can maintain, specified as a positive integer.

Maximum number of branches per track that the branch history manager can maintain, specified as a positive integer.




history = branchHistoryMgr(assignments,unassignedTracks,unassignedDetections,originatingSensor) returns the branch history based on the results of an assignment algorithm. Specify the assignments of detections to branches, the lists of unassigned tracks and unassigned detections, and the IDs of the sensors from which the detections originated. The inputs can be of any numeric data type.

The assignTOMHT function returns assignment results as uint32 values, but the inputs to branchHistoryMgr can be of any numeric data type.

Input Arguments

expand all

Assignment of track branches to detections, specified as a P-by-2 matrix of integers, where P is the number of assignments. The first column lists the track branch indices. The second column lists the detection indices. The same branch can be assigned to multiple detections. The same detection can be assigned to multiple branches.

For example, if assignments = [1 1; 1 2; 2 1; 2 2], the rows of assignments specify these assignments:

  • [1 1] — Branch 1 was assigned to detection 1.

  • [1 2] — Branch 1 was assigned to detection 2.

  • [2 1] — Branch 2 was assigned to detection 1.

  • [2 2] — Branch 2 was assigned to detection 2.

Indices of unassigned track branches, specified as a Q-by-1 vector of integers, where Q is the number of unassigned track branches. Each element of unassignedTracks must correspond to the indices of a track branch currently stored in the trackBranchHistory System object.

Indices of unassigned detections, specified as an R-by-1 vector of integers, where R is the number of unassigned detections. Each unassigned detection results in a new track branch.

Indices of sensors from which each detection originated, specified as a 1-by-L vector of integers, where L is the number of detections. The ith element of originatingSensor corresponds to the SensorIndex property value of objectDetection object i.

Output Arguments

expand all

Branch history, returned 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














Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:


expand all

getHistoryGet branch history of maintained tracks
stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object


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

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

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

View the updated branch history.

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.


[1] Werthmann, John R. "A Step-by-Step Description of a Computationally Efficient Version of Multiple Hypothesis Tracking." In Proceedings of SPIE Vol. 1698, Signal and Processing of Small Targets. 1992, pp. 288–300. doi: 10.1117/12.139379.

Version History

Introduced in R2018b