Tracker Base Class
Base abstract class for long-term object trackers.init
Initialize the tracker with a known bounding box that surrounds the target.The initial frame containing the object to track.
The initial bounding box surrounding the target object.
update
Update the tracker and find the new most likely bounding box for the target.The current frame to process.
Output parameter for the new target location. Updated only if the function returns true.
true if the target was located, false if the tracker cannot locate the target. Note that false does not necessarily mean the tracker has failed—the target may be temporarily out of view.
KalmanFilter
Implements a standard Kalman filter for state estimation.Constructor
Dimensionality of the state vector.
Dimensionality of the measurement vector.
Dimensionality of the control vector. Default: 0 (no control).
Type of the created matrices. Should be CV_32F or CV_64F. Default: CV_32F.
predict
Computes a predicted state.Optional input control vector.
correct
Updates the predicted state from the measurement.The measured system parameters.
The Kalman filter operates in two steps: prediction (using the system model) and correction (using measurements). The filter maintains estimates of the state and its uncertainty through covariance matrices.
Example
TrackerMIL
Multiple Instance Learning (MIL) tracker that trains a classifier online to separate object from background.MIL avoids the drift problem for robust tracking. The implementation is based on “Visual Tracking with Online Multiple Instance Learning” by Babenko et al.
Example
TrackerGOTURN
Generic Object Tracking Using Regression Networks - a CNN-based tracker trained offline.GOTURN is much faster than online-training CNN trackers due to its offline training approach. It handles viewpoint changes, lighting changes, and deformations well, but does not handle occlusions. Requires pre-trained models (goturn.prototxt and goturn.caffemodel).
Example
TrackerDaSiamRPN
Deep learning-based tracker using Siamese Region Proposal Networks.Returns the tracking confidence score for the current frame.
TrackerNano
Super lightweight DNN-based tracker with model size of only 1.9 MB.Nano tracker is extremely lightweight and fast due to its special model structure. Requires two models: one for feature extraction (backbone) and another for localization (neckhead).
TrackerVit
Vision Transformer (ViT) based tracker, extremely lightweight at approximately 767KB.Mean values for image preprocessing. Default: (0.485, 0.456, 0.406)
Standard deviation values for image preprocessing. Default: (0.229, 0.224, 0.225)
Minimum confidence threshold for tracking. Default: 0.20
Comparison of Trackers
- Classical
- Deep Learning (Medium)
- Deep Learning (Fast)
MIL (Multiple Instance Learning)
- Pros: Robust, handles appearance changes
- Cons: Slower than modern methods
- Use case: General purpose tracking
