# oaid/objecttracker architecture

> Architecture diagram of the GitHub repository oaid/objecttracker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/oaid/objecttracker
- Repository: https://github.com/oaid/objecttracker

## Overview

##### Project Type and Purpose
- This is an open-source C++ object-tracking tool and library (TrackTLD), derived from the original OpenTLD.
- It provides:
- A reusable library implementing the TLD (Tracking-Learning-Detection) framework (src/libopentld)
- Two short-term trackers based on correlation filters (kernelized CF and DSST) in src/3rdparty/cf_tracking
- A command-line and GUI application (src/opentld/main) for real-time tracking with webcam input
- Sample Python benchmarking scripts (sample/benchmark)

##### High-Level Directory/Component Analysis
- Top-level CMakeLists.txt: orchestrates building of all subcomponents.
- src/3rdparty:
- cf_tracking: implements two CF-based trackers, wraps PMT FHOG features, TCLAP for CLI parsing
- libconfig: configuration file parser
- src/libopentld: core TLD library (image acquisition abstraction, detector cascade, classifier, clustering)
- src/opentld: application layer
- main: Config, GUI (Qt or native), JSON logging, performance hooks, trajectory persistence
- sample/benchmark: Python scripts to invoke the built binary for accuracy and performance testing

##### Final Recommendations
- Detail the runtime pipeline from webcam frame to GUI output
- Don’t omit the sample/benchmark scripts—they illustrate integration & CI use cases

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Build System
    subgraph "Build System"
        CMake["CMakeLists.txt"]:::build
        ConfigCMake["OpenTLDConfig.cmake.in"]:::build
        CMake_cf["cf_tracking CMake"]:::build
        CMake_libconfig["libconfig CMake"]:::build
        CMake_libopentld["libopentld CMake"]:::build
        CMake_app["opentld CMake"]:::build
    end

    %% Algorithm Libraries
    subgraph "cf_tracking Library" 
        CfTrackingDir["cf_tracking Directory"]:::libraries
    end
    subgraph "libconfig Parser"
        LibConfig["libconfig Directory"]:::libraries
    end

    %% Core TLD Engine
    subgraph "libopentld Core Library"
        LibOpenTLD["libopentld Directory"]:::core
    end

    %% Application/UI
    subgraph "Application Executable (OpenTLD / cftld)"
        AppExec["OpenTLD.cpp"]:::app
        AppMain["main Module"]:::app
        ConfigMod["Config & Settings"]:::app
        GUI["GUI/CLI Interface"]:::app
        Traj["Trajectory Persistence"]:::app
        Log["JSON Logging"]:::app
    end

    %% Sample Benchmark Suite
    subgraph "Sample Benchmark Suite"
        BenchmarkDir["benchmark Scripts"]:::external
    end

    %% Build Dependencies
    CMake --> CMake_cf
    CMake --> CMake_libconfig
    CMake --> CMake_libopentld
    CMake --> CMake_app
    CMake_cf --> CfTrackingDir
    CMake_libconfig --> LibConfig
    CMake_libopentld --> LibOpenTLD
    CMake_app --> AppExec

    %% Runtime Pipeline
    User["User"]:::external --> GUI
    GUI --> ConfigMod
    GUI --> ImageAcq["Image Acquisition"]:::app
    ImageAcq --> TrackerMgr["Tracker Manager"]:::app
    TrackerMgr --> CfTrackingDir
    TrackerMgr --> DetectorCascade["Detector Cascade"]:::core
    DetectorCascade --> CfTrackingDir
    TrackerMgr --> GUI
    TrackerMgr --> Log

    %% Click Events
    click CMake "https://github.com/oaid/objecttracker/blob/master/CMakeLists.txt"
    click ConfigCMake "https://github.com/oaid/objecttracker/blob/master/OpenTLDConfig.cmake.in"
    click CMake_cf "https://github.com/oaid/objecttracker/blob/master/src/3rdparty/cf_tracking/CMakeLists.txt"
    click CMake_libconfig "https://github.com/oaid/objecttracker/blob/master/src/3rdparty/libconfig/CMakeLists.txt"
    click CMake_libopentld "https://github.com/oaid/objecttracker/blob/master/src/libopentld/CMakeLists.txt"
    click CMake_app "https://github.com/oaid/objecttracker/blob/master/src/opentld/CMakeLists.txt"
    click CfTrackingDir "https://github.com/oaid/objecttracker/tree/master/src/3rdparty/cf_tracking"
    click LibConfig "https://github.com/oaid/objecttracker/tree/master/src/3rdparty/libconfig"
    click LibOpenTLD "https://github.com/oaid/objecttracker/tree/master/src/libopentld"
    click AppExec "https://github.com/oaid/objecttracker/blob/master/src/opentld/OpenTLD.cpp"
    click AppMain "https://github.com/oaid/objecttracker/tree/master/src/opentld/main"
    click ConfigMod "https://github.com/oaid/objecttracker/blob/master/src/opentld/main/Config.cpp"
    click GUI "https://github.com/oaid/objecttracker/blob/master/src/opentld/main/Gui.cpp"
    click Traj "https://github.com/oaid/objecttracker/blob/master/src/opentld/main/Trajectory.cpp"
    click Log "https://github.com/oaid/objecttracker/blob/master/src/opentld/main/json.cpp"
    click BenchmarkDir "https://github.com/oaid/objecttracker/tree/master/sample/benchmark"

    %% Styles
    classDef build fill:#dddddd,stroke:#333,stroke-width:1px
    classDef libraries fill:#add8e6,stroke:#333,stroke-width:1px
    classDef core fill:#90ee90,stroke:#333,stroke-width:1px
    classDef app fill:#ffa500,stroke:#333,stroke-width:1px
    classDef external fill:#ffff66,stroke:#333,stroke-width:1px
```
