Skip to content

luzhcs/motcpp

 
 

motcpp

motcpp

Modern C++ Multi-Object Tracking Library

ByteTrack
ByteTrack
OC-SORT
OC-SORT
BoostTrack
BoostTrack
SORT
SORT

CI Coverage Release License Stars

FeaturesInstallationQuick StartTrackersBenchmarksDocumentation


motcpp is a high-performance, production-ready C++ library for multi-object tracking. It provides state-of-the-art tracking algorithms with a clean, modern C++17 API designed for real-time applications.

✨ Features

  • 🎯 10 State-of-the-Art Trackers — SORT, ByteTrack, OC-SORT, DeepOC-SORT, StrongSORT, BoT-SORT, BoostTrack, HybridSORT, UCMCTrack, OracleTrack
  • Blazing Fast — Optimized C++ implementation, 10-100x faster than Python equivalents
  • 🔧 Easy Integration — Modern CMake, single-header option, vcpkg support
  • 🧪 Well Tested — Comprehensive unit tests with >90% code coverage
  • 📦 Cross-Platform — Linux, macOS, Windows
  • 🔌 Flexible ReID — ONNX Runtime backend for appearance embeddings
  • 📊 MOT Benchmark Ready — Built-in evaluation tools for MOT17/MOT20

📊 Benchmarks

MOT17 Ablation Split

Tracker HOTA↑ MOTA↑ IDF1↑ FPS
SORT 62.4 75.2 69.2 1250
ByteTrack 66.5 76.4 77.6 1100
OC-SORT 64.6 73.9 74.4 850
UCMCTrack 64.0 75.6 73.9 980
BoostTrack 67.5 77.1 79.2 75

Evaluation on the second half of the MOT17 training set using YOLOX detections and FastReID embeddings. Pre-generated data available in releases. FPS measured on Intel i9-13900K.

C++ vs Python Performance

Tracker C++ (FPS) Python (FPS) Speedup
ByteTrack 1100 45 24x
OC-SORT 850 32 27x
StrongSORT 95 8 12x

🚀 Installation

Prerequisites

  • C++17 compiler (GCC 9+, Clang 10+, MSVC 2019+)
  • CMake 3.16+
  • OpenCV 4.x
  • Eigen3

Build from Source

git clone https://github.com/Geekgineer/motcpp.git
cd motcpp
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j$(nproc)
sudo cmake --install build

CMake Integration

find_package(motcpp REQUIRED)
target_link_libraries(your_target PRIVATE motcpp::motcpp)

🎮 Quick Start

#include <motcpp/trackers/bytetrack.hpp>
#include <opencv2/opencv.hpp>

int main() {
    // Create tracker
    motcpp::trackers::ByteTrack tracker;
    
    cv::VideoCapture cap("video.mp4");
    cv::Mat frame;
    
    while (cap.read(frame)) {
        // Your detector outputs: [x1, y1, x2, y2, confidence, class_id]
        Eigen::MatrixXf detections = your_detector(frame);
        
        // Update tracker
        Eigen::MatrixXf tracks = tracker.update(detections, frame);
        
        // tracks: [x1, y1, x2, y2, track_id, confidence, class_id, det_index]
        for (int i = 0; i < tracks.rows(); ++i) {
            int track_id = static_cast<int>(tracks(i, 4));
            cv::Rect box(tracks(i, 0), tracks(i, 1), 
                        tracks(i, 2) - tracks(i, 0), 
                        tracks(i, 3) - tracks(i, 1));
            
            cv::rectangle(frame, box, motcpp::BaseTracker::id_to_color(track_id), 2);
        }
        
        cv::imshow("Tracking", frame);
        if (cv::waitKey(1) == 27) break;
    }
    
    return 0;
}

📋 Trackers

Tracker Type Speed Paper
SORT Motion ⚡⚡⚡⚡⚡ Bewley et al., 2016
ByteTrack Motion ⚡⚡⚡⚡⚡ Zhang et al., ECCV 2022
OC-SORT Motion ⚡⚡⚡⚡ Cao et al., CVPR 2023
UCMCTrack Motion ⚡⚡⚡⚡ Yi et al., AAAI 2024
OracleTrack Motion ⚡⚡⚡⚡ Kalman + CMC + Cascaded Association
DeepOC-SORT ReID ⚡⚡⚡ Maggiolino et al., 2023
StrongSORT ReID ⚡⚡ Du et al., TMM 2023
BoT-SORT ReID ⚡⚡ Aharon et al., 2022
BoostTrack ReID ⚡⚡ Stanojevic et al., MVA 2024
HybridSORT ReID ⚡⚡ Yang et al., AAAI 2024

Tracker Selection Guide

Need maximum speed?     → SORT, ByteTrack, OracleTrack
General purpose?        → ByteTrack, OC-SORT, OracleTrack
Heavy occlusions?       → OC-SORT, UCMCTrack, OracleTrack
Moving camera?          → UCMCTrack, BoT-SORT, OracleTrack
Re-identification?      → StrongSORT, BoostTrack
State-of-the-art?       → BoostTrack

📚 Documentation

Resource Description
📖 Getting Started Installation and first steps
🔍 API Reference Complete API documentation
📝 Tutorials Step-by-step guides
💡 Examples Code examples
🎯 Tracker Guide Choosing the right tracker
🏗️ Architecture System design
📊 Benchmarking Run your own benchmarks

🧪 Testing

cmake -B build -DMOTCPP_BUILD_TESTS=ON
cmake --build build
cd build && ctest --output-on-failure

🤝 Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

📜 Citation

If you use motcpp in your research, please cite:

@software{motcpp2026,
  author = {motcpp contributors},
  title = {motcpp: Modern C++ Multi-Object Tracking Library},
  year = {2026},
  url = {https://github.com/Geekgineer/motcpp},
  license = {AGPL-3.0}
}

📄 License

This project is licensed under the GNU Affero General Public License v3.0 - see the LICENSE file for details.

🙏 Acknowledgments

Special Thanks

This project draws inspiration from and builds upon the excellent work of:

Project Description
BoxMOT The original Python multi-object tracking library by Mikel Broström. Our C++ implementation follows similar architecture patterns and algorithm implementations.

Tracking Algorithms

Algorithm Paper Authors
SORT Simple Online and Realtime Tracking Bewley et al., 2016
ByteTrack ByteTrack: Multi-Object Tracking by Associating Every Detection Box Zhang et al., ECCV 2022
OC-SORT Observation-Centric SORT Cao et al., CVPR 2023
StrongSORT StrongSORT: Make DeepSORT Great Again Du et al., TMM 2023
BoT-SORT BoT-SORT: Robust Associations Multi-Pedestrian Tracking Aharon et al., 2022
UCMCTrack UCMCTrack: Multi-Object Tracking with Uniform Camera Motion Compensation Yi et al., AAAI 2024
BoostTrack BoostTrack: Boosting the Similarity Measure and Detection Confidence Stanojevic et al., MVA 2024
HybridSORT Hybrid-SORT: Weak Cues Matter for Online Multi-Object Tracking Yang et al., AAAI 2024

Benchmark Data & Tools

Resource Source Citation
MOT17 Dataset MOTChallenge Milan et al., 2016
YOLOX Detections YOLOX Ge et al., 2021
ReID Embeddings FastReID He et al., 2020

Made with ❤️ by the motcpp community

About

A blazing-fast, modern C++ multi-object tracking library featuring SORT, ByteTrack, OC-SORT, BoostTrack, and more built for real-time performance, cross-platform deployment, and MOT benchmarks.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • C++ 86.9%
  • Python 6.7%
  • CMake 4.1%
  • Shell 2.3%