Main Content

videoTracker

Task-oriented video tracker

Since R2026a

    Description

    tracker = videoTracker(algorithm) creates a task-oriented video tracker System object™ based on the algorithm specified in algorithm. The tracker tracks bounding boxes in videos. These video tracker System objects support the outputs of object detectors and object re-identification networks from the Computer Vision Toolbox™.

    example

    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
    
    

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

    DSTracker = videoTracker("deepsort");
    DSTracker.FrameSize = [800 600];
    DSTracker.FrameRate = 1;

    Specify the appearance update method as "Gallery", and the number of appearance frames to keep in the gallery as 50.

    DSTracker.AppearanceUpdate = "Gallery";
    DSTracker.NumAppearanceFrames = 50;

    For how to use a DeepSORTVideoTracker object to track targets in a video, see Multi-Object Tracking with DeepSORT.

    Input Arguments

    collapse all

    Video tracking algorithm, specified as "sort" for the Simple Online and Realtime (SORT) or "deepsort" for the Deep Simple Online and Realtime (DeepSORT) multi-object tracking algorithms.

    Output Arguments

    collapse all

    Video tracker, returned as a System object based on the algorithm specified in algorithm.

    Input algorithm ArgumentTracker
    "sort"SORTVideoTracker
    "deepsort"DeepSORTVideoTracker

    Version History

    Introduced in R2026a