Skip to main content

Overview

OpenCV provides multiple tracking algorithms for different use cases:
  • Optical Flow (Lucas-Kanade): Track sparse feature points
  • MIL Tracker: Multiple Instance Learning, CPU-friendly
  • GOTURN: Deep learning tracker using Caffe models
  • DaSiamRPN: State-of-the-art Siamese network tracker
  • NanoTrack: Lightweight deep learning tracker
  • Planar Tracking: Track planar objects using feature matching

Lucas-Kanade Optical Flow Tracker

Sparse optical flow tracking with automatic feature detection and back-tracking for verification.

Modern DNN-Based Trackers

High-performance trackers using deep learning models.

Planar Object Tracker

Track planar objects using feature matching with ORB and FLANN.

Tracker Comparison

TrackerSpeedAccuracyCPU/GPUUse Case
Lucas-KanadeVery FastMediumCPUFeature tracking, motion analysis
MILFastGoodCPUGeneral object tracking
GOTURNFastGoodCPU/GPUReal-time tracking
DaSiamRPNMediumExcellentCPU/GPUHigh accuracy requirements
NanoTrackFastVery GoodCPU/GPUMobile/embedded
PlanarMediumExcellentCPUTextured planar objects

Key Parameters

Lucas-Kanade

Feature Detection

Model Downloads: Deep learning tracker models are available from:

Best Practices

1

Choose Right Tracker

Select based on your requirements:
  • Speed critical: Lucas-Kanade or NanoTrack
  • Accuracy critical: DaSiamRPN
  • CPU-only: MIL or Lucas-Kanade
  • Planar objects: Planar tracker
2

Handle Tracking Failures

Implement recovery mechanisms:
3

Combine with Detection

Use detector periodically to recover from failures:
4

Optimize Performance

  • Resize frames for faster processing
  • Use GPU backend when available
  • Reduce detection frequency in optical flow
Tracker Initialization: All trackers require a good initial bounding box. Poor initialization will lead to immediate tracking failure.

Next Steps