主要内容

SORTVideoTracker

Simple Online and Realtime (SORT) video tracker

Since R2026a

Description

The SORTVideoTracker System object™ is a tracker capable of processing detections of multiple targets from a video using the Simple Online and Realtime (SORT) algorithm[1]. The tracker initializes, confirms, corrects, predicts (performs coasting), and deletes tracks. Inputs to the tracker are bounding boxes reported by video detectors in the form of [x y w h], where x and y define the upper left corner of the box, w and h define the width and height of the box, respectively. The tracker outputs tracks with the same bounding box definition.

This tracker supports the outputs of object detectors from the Computer Vision Toolbox™. For more information, see Choose an Object Detector (Computer Vision Toolbox).

To track targets in a video using this object:

  1. Create the SORTVideoTracker 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?

Creation

To create a SORTVideoTracker System object, use the videoTracker function with "sort" algorithm. For example:

tracker = videoTracker("sort")

Properties

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.

Tracking frame size in pixels, specified as a row or column vector of the form [width height].

Data Types: single | double

Tracking frame rate in frames per second, specified as a positive scalar.

Data Types: single | double

Minimum intersection-over-union (IoU) ratio for assignment, specified as a scalar in the range (0,1]. If the IoU between a measurement and a track is less than this threshold, the measurement is not considered a match to that track.

Tunable: Yes

Data Types: single | double

Minimum number of updates required for track confirmation, specified as a 1-by-2 vector, [M N]. A new track is confirmed if it is updated at least M times in the last N frames.

Data Types: single | double

Minimum number of misses required for track deletion, specified as a 1-by-2 vector, [P Q]. The tracker deletes an existing track if the track misses more than P updates in the last Q frames.

Data Types: single | double

Usage

Description

confirmedTracks = tracker(bboxes) returns a list of confirmed tracks updated from a video based on the input bounding boxes.

example

[confirmedTracks,tentativeTracks,allTracks] = tracker(___) also provides a list of tentative tracks and a list of all tracks. Tentative tracks are tracks that have not yet reached the threshold specified in the NumUpdatesForConfirmation property.

Input Arguments

expand all

Bounding boxes of detection within the video frame, specified as an N-by-4 numerical matrix with rows of the form [x y w h], where:

  • N is the number of detected bounding boxes within the video frame.

  • x and y specify the upper-left corner of the bounding box.

  • h specifies the height of the box.

  • w specifies the width of the box.

You can use the output bounding boxes of object detectors from the Computer Vision Toolbox. For more information, see Choose an Object Detector (Computer Vision Toolbox).

Output Arguments

expand all

Confirmed tracks, returned as a structure array containing these fields:

Field NameDescription
TrackIDUnique identifier for each track.
AgeNumber of times the track has been updated. When a track is initialized, its Age is equal to 1. Any subsequent update with a hit or miss increases the track Age by 1.
TimeTime at which the track was updated by the tracker.
BoundingBoxCurrent bounding box of the track, in the same format as the bboxes argument.
IsConfirmedLogical value indicating whether the track is confirmed.

A track becomes confirmed when it meets the confirmation threshold defined by the NumUpdatesForConfirmation property. In this case, the tracker logs the track in confirmedTracks and sets the IsConfirmed field to true.

Tentative tracks, returned as a structure array containing these fields:

Field NameDescription
TrackIDUnique identifier for each track.
AgeNumber of times the track has been updated. When a track is initialized, its Age is equal to 1. Any subsequent update with a hit or miss increases the track Age by 1.
TimeTime at which the track was updated by the tracker.
BoundingBoxCurrent bounding box of the track, in the same format as the bboxes argument.
IsConfirmedLogical value indicating whether the track is confirmed.

A track is tentative if it does not meet the confirmation threshold defined by the NumUpdatesForConfirmation property. In this case, the tracker logs the track in tentativeTracks and sets the IsConfirmed field to false.

All tracks, returned as a structure array containing these fields:

Field NameDescription
TrackIDUnique identifier for each track.
AgeNumber of times the track has been updated. When a track is initialized, its Age is equal to 1. Any subsequent update with a hit or miss increases the track Age by 1.
TimeTime at which the track was updated by the tracker.
BoundingBoxCurrent bounding box of the track, in the same format as the bboxes argument.
IsConfirmedLogical value indicating whether the track is confirmed.

allTracks consists of confirmed and tentative tracks.

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:

release(obj)

expand all

stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object
isLockedDetermine if System object is in use
cloneCreate duplicate System object

Examples

collapse all

Create a SORTVideoTracker object, specify the frame rate of the tracking video as 20 frames per second and the frame size as 800 by 600 pixels.

VTracker = videoTracker("sort");
VTracker.FrameSize = [800 600];
VTracker.FrameRate = 20;

Specify that the tracker requires 2 updates in the last 3 frames for track confirmation.

VTracker.NumUpdatesForConfirmation = [2 3];

Define 2 bounding boxes.

bbox1 = [230 260 110 140]; % [x y width height]
bbox2 = [245 275 130 160];

Update the tracker sequentially with the bounding boxes. After the first update (trackLog1), the track’s age is only 1 frame, so it does not meet the confirmation requirement (NumUpdatesForConfirmation) yet. As a result, tracklog1 is empty. After the second update (trackLog2), the same track has been updated twice, satisfying the requirement of 2 updates in the last 3 frames. As a result, tracklog2 contains a confirmed track.

trackLog1 = VTracker(bbox1)
trackLog1 = 

  0×1 empty struct array with fields:

    TrackID
    Time
    Age
    BoundingBox
    IsConfirmed
trackLog2 = VTracker(bbox2)
trackLog2 = struct with fields:
        TrackID: 1
           Time: 0.1000
            Age: 2
    BoundingBox: [237.6445 267.6445 120.0637 150.0637]
    IsConfirmed: 1

References

[1] Bewley, Alex, Zongyuan Ge, Lionel Ott, Fabio Ramos, and Ben Upcroft. "Simple online and realtime tracking." In 2016 IEEE international conference on image processing (ICIP), pp. 3464-3468. IEEE, 2016.

Version History

Introduced in R2026a