ObjectTracker
ObjectTracker
associates detections across frames, assigning stable IDs and reporting per-track status. It takes detections from a DetectionNetwork / SpatialDetectionNetwork and outputs Tracklets. When the upstream node is a SpatialDetectionNetwork, each tracklet also carries spatialCoordinates (X/Y/Z in mm).In DepthAI v3, tracklets and frames additionally expose transformation metadata that allows remapping ROIs across streams (e.g., RGB → depth), as shown in the Object Tracker Remap example.How to place it
Python
C++
Python
Python
1with dai.Pipeline() as pipeline:
2 objectTracker = pipeline.create(dai.node.ObjectTracker)
Inputs and Outputs
Zero term tracking
Associates current-frame detections to existing tracks (no temporal prediction).Short term tracking
Propagates tracks between detector frames by extrapolating motion, which helps when the detector isn’t running every frame.Supported object tracker types
SHORT_TERM_IMAGELESS
– tracks objects across frames using only bounding box position and size (no color data). Lightweight and fast, suitable for real-time use.
setTrackerType(...)
. The ID policy is set with setTrackerIdAssignmentPolicy(...)
and can be SMALLEST_ID
or UNIQUE_ID
.Limit: Up to 1000 tracked objects (cap via
setMaxObjectsToTrack(...)
)Examples of functionality
Reference
class
dai::node::ObjectTracker
variable
Input inputTrackerFrame
Input ImgFrame message on which tracking will be performed. RGBp, BGRp, NV12, YUV420p types are supported. Default queue is non-blocking with size 4.
variable
Input inputDetectionFrame
Input ImgFrame message on which object detection was performed. Default queue is non-blocking with size 4.
variable
Input inputDetections
Input message with image detection from neural network. Default queue is non-blocking with size 4.
variable
Input inputConfig
Input ObjectTrackerConfig message with ability to modify parameters at runtime. Default queue is non-blocking with size 4.
variable
variable
Output passthroughTrackerFrame
Passthrough ImgFrame message on which tracking was performed. Suitable for when input queue is set to non-blocking behavior.
variable
Output passthroughDetectionFrame
Passthrough ImgFrame message on which object detection was performed. Suitable for when input queue is set to non-blocking behavior.
variable
Output passthroughDetections
Passthrough image detections message from neural network output. Suitable for when input queue is set to non-blocking behavior.
function
void setTrackerThreshold(float threshold)
Specify tracker threshold.
Parameters
- threshold: Above this threshold the detected objects will be tracked. Default 0, all image detections are tracked.
function
void setMaxObjectsToTrack(std::int32_t maxObjectsToTrack)
Specify maximum number of object to track.
Parameters
- maxObjectsToTrack: Maximum number of object to track. Maximum 60 in case of SHORT_TERM_KCF, otherwise 1000.
function
void setDetectionLabelsToTrack(std::vector< std::uint32_t > labels)
Specify detection labels to track.
Parameters
- labels: Detection labels to track. Default every label is tracked from image detection network output.
function
void setTrackerType(TrackerType type)
Specify tracker type algorithm.
Parameters
- type: Tracker type.
function
void setTrackerIdAssignmentPolicy(TrackerIdAssignmentPolicy type)
Specify tracker ID assignment policy.
Parameters
- type: Tracker ID assignment policy.
function
void setTrackingPerClass(bool trackingPerClass)
Whether tracker should take into consideration class label for tracking.
function
void setOcclusionRatioThreshold(float theshold)
Set the occlusion ratio threshold. Used to filter out overlapping tracklets.
Parameters
- theshold: Occlusion ratio threshold. Default 0.3.
function
void setTrackletMaxLifespan(uint32_t trackletMaxLifespan)
Set the tracklet lifespan in number of frames. Number of frames after which a LOST tracklet is removed.
Parameters
- trackletMaxLifespan: Tracklet lifespan in number of frames. Default 120.
function
void setTrackletBirthThreshold(uint32_t trackletBirthThreshold)
Set the tracklet birth threshold. Minimum consecutive tracked frames required to consider a tracklet as a new (TRACKED) instance.
Parameters
- trackletBirthThreshold: Tracklet birth threshold. Default 3.
function
void setRunOnHost(bool runOnHost)
Specify whether to run on host or device By default, the node will run on device.
function
bool runOnHost()
Check if the node is set to run on host
function
void run()
inline function
DeviceNodeCRTP()
inline function
DeviceNodeCRTP(const std::shared_ptr< Device > & device)
inline function
DeviceNodeCRTP(std::unique_ptr< Properties > props)
inline function
DeviceNodeCRTP(std::unique_ptr< Properties > props, bool confMode)
inline function
DeviceNodeCRTP(const std::shared_ptr< Device > & device, std::unique_ptr< Properties > props, bool confMode)
Need assistance?
Head over to Discussion Forum for technical support or any other questions you might have.