# stereolabs/zed-sdk architecture

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

- Interactive diagram: https://gitdiagram.com/stereolabs/zed-sdk
- Repository: https://github.com/stereolabs/zed-sdk

## Overview

##### Project Type and Purpose
- This repository is an **open-source sample collection** for the ZED SDK, demonstrating how to use Stereolabs’ ZED stereo cameras in C++, Python, C#, and C.
- It is organized by **feature modules** (Depth Sensing, Body Tracking, Object Detection, etc.) plus a set of **tutorials**, and contains sample applications and exporters (JSON, FBX, KML, SVO).

##### File-Structure Analysis
- **Top-Level Folders**:
- tutorials
- camera control
- camera streaming
- depth sensing
- positional tracking
- global localization
- spatial mapping
- object detection
- body tracking
- recording
- zed one
- Each feature folder contains language-specific subfolders (cpp, python, csharp, sometimes c) with build scripts (CMakeLists.txt), source (src/), headers (include/), and README.
- **Special Submodules**:
– global localization/map server (a small web server serving map tiles)
– global localization/live, playback, recording (fusion with GNSS)
– exporters (JSON, FBX, KML, SVO)
– camera streaming sender/receiver (network sockets)

##### Insights from README
- The README defines the **SDK’s feature modules**, supported languages, and integration points.
- Emphasizes real-time performance, multi-language API, and external integrations (OpenGL, OpenCV, ROS, Unity).

##### Essential Details to Capture
- The **multi-language** nature (C++, Python, C#, C).
- The **modularity**: one core SDK with many independent sample demos.
- **Data flows**: raw camera frames → processing → visualization / export / network.
- **Build artifacts**: CMake / Visual Studio / pip.
- **Networking** lanes for streaming and web map server.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Hardware
    ZEDCam["ZED Camera Hardware"]:::hardware

    %% Core SDK
    SDK["ZED Core SDK"]:::core

    ZEDCam -->|"video + IMU + depth"| SDK

    %% Language Bindings
    subgraph "Language Bindings"
        CppBind["C++ Binding"]:::binding
        PyBind["Python Binding"]:::binding
        CsBind["C# Binding"]:::binding
        CBind["C Binding"]:::binding
    end

    SDK -->|"C API"| CBind
    SDK -->|"wrapped by"| CppBind
    SDK -->|"wrapped by"| PyBind
    SDK -->|"wrapped by"| CsBind

    %% Feature Modules
    subgraph "Feature Modules"
        %% Depth Sensing
        subgraph "Depth Sensing"
            DSM["Depth Sensing Module"]:::feature
            ARI["Automatic Region of Interest"]:::feature
            DSF["Depth Sensing Fusion"]:::feature
        end

        %% Body Tracking
        subgraph "Body Tracking"
            BTM["Body Tracking Module"]:::feature
            BTJSON["Body Tracking JSON Exporter"]:::exporter
            BTFBX["Body Tracking FBX Exporter"]:::exporter
            BTMC["Body Tracking Multi-Camera Streaming"]:::network
        end

        %% Object Detection
        subgraph "Object Detection"
            ODC["Object Detection Core Samples"]:::feature
            ODBEV["Birds-Eye Viewer"]:::feature
            ODCD["Concurrent Detections"]:::feature
            ODCU["Custom Detectors"]:::feature
            ODI["Image Viewer"]:::feature
            ODMC["Multi-Camera Publisher"]:::network
        end

        %% Plane Detection
        subgraph "Plane Detection"
            PDM["Plane Detection Module"]:::feature
            PDFP["Floor Plane Sample"]:::feature
        end

        %% Positional Tracking
        subgraph "Positional Tracking"
            PTCore["Positional Tracking Core Samples"]:::feature
            PTFBX["Positional Tracking FBX Exporter"]:::exporter
        end

        %% Spatial Mapping
        subgraph "Spatial Mapping"
            SMCore["Spatial Mapping Core Samples"]:::feature
            SMMC["Spatial Mapping Multi-Camera Publisher"]:::network
        end

        %% Camera Control
        CCS["Camera Control Samples"]:::feature

        %% Camera Streaming
        CSS["Camera Streaming Sender"]:::network
        CSR["Camera Streaming Receiver"]:::network

        %% Recording
        subgraph "Recording"
            RC["Recording Core"]:::feature
            RP["Recording Playback Pipelines"]:::feature
            RE["Recording Exporters"]:::exporter
        end

        %% Global Localization
        subgraph "Global Localization"
            GLLive["Live GNSS & KML Exporter"]:::feature
            GLPlay["Playback & Replay"]:::feature
            GLRec["Recording with GNSS Saver"]:::feature
            GLMap["Map Server (Web Tiles)"]:::external
        end

        %% ZED One
        ZOS["ZED One Samples & Streaming"]:::feature

        %% Tutorials
        Tuts["Tutorials (C, C++, C#, Python)"]:::feature
    end

    %% Bindings to Modules
    CppBind -->|uses| DSM
    PyBind -->|uses| DSM
    CsBind -->|uses| DSM
    CBind -->|uses| DSM

    CppBind -->|uses| BTM
    PyBind -->|uses| BTM
    CsBind -->|uses| BTM
    CBind -->|uses| BTM

    CppBind -->|uses| ODC
    PyBind -->|uses| ODC
    CsBind -->|uses| ODC
    CBind -->|uses| ODC

    CppBind -->|uses| PDM
    PyBind -->|uses| PDM
    CsBind -->|uses| PDM
    CBind -->|uses| PDM

    CppBind -->|uses| PTCore
    PyBind -->|uses| PTCore
    CsBind -->|uses| PTCore
    CBind -->|uses| PTCore

    CppBind -->|uses| SMCore
    PyBind -->|uses| SMCore
    CsBind -->|uses| SMCore
    CBind -->|uses| SMCore

    CppBind -->|uses| CCS
    PyBind -->|uses| CCS
    CsBind -->|uses| CCS
    CBind -->|uses| CCS

    CppBind -->|uses| CSS
    PyBind -->|uses| CSS
    CsBind -->|uses| CSS
    CBind -->|uses| CSS

    CppBind -->|uses| RC
    PyBind -->|uses| RC
    CsBind -->|uses| RC
    CBind -->|uses| RC

    CppBind -->|uses| GLLive
    PyBind -->|uses| GLLive
    CsBind -->|uses| GLLive
    CBind -->|uses| GLLive

    CppBind -->|uses| ZOS
    PyBind -->|uses| ZOS
    CsBind -->|uses| ZOS
    CBind -->|uses| ZOS

    CppBind -->|uses| Tuts
    PyBind -->|uses| Tuts
    CsBind -->|uses| Tuts
    CBind -->|uses| Tuts

    %% Module Internal Relationships
    DSM --> ARI
    DSM --> DSF

    BTM --> BTJSON
    BTM --> BTFBX
    BTM --> BTMC

    ODC --> ODBEV
    ODC --> ODCD
    ODC --> ODCU
    ODC --> ODI
    ODC --> ODMC

    PTCore --> PTFBX

    SMCore --> SMMC

    %% Streaming Network
    CSS -->|TCP/UDP| CSR
    BTMC -->|TCP/UDP| ODMC
    SMMC -->|TCP/UDP| CSR

    %% Global Localization flow
    GLLive -->|exports KML| GLMap
    GLRec -->|saves GNSS| GLMap
    GLPlay -->|serves tiles| GLMap

    GLMap -->|HTTP| Browser["Web Browser"]:::external

    %% Click events
    click DSM "https://github.com/stereolabs/zed-sdk/tree/master/depth sensing/depth sensing"
    click ARI "https://github.com/stereolabs/zed-sdk/tree/master/depth sensing/automatic region of interest"
    click DSF "https://github.com/stereolabs/zed-sdk/tree/master/depth sensing/fusion"
    click BTM "https://github.com/stereolabs/zed-sdk/tree/master/body tracking/body tracking"
    click BTJSON "https://github.com/stereolabs/zed-sdk/tree/master/body tracking/export/JSON export"
    click BTFBX "https://github.com/stereolabs/zed-sdk/tree/master/body tracking/export/fbx export"
    click BTMC "https://github.com/stereolabs/zed-sdk/tree/master/body tracking/multi-camera"
    click ODC "https://github.com/stereolabs/zed-sdk/tree/master/object detection"
    click ODBEV "https://github.com/stereolabs/zed-sdk/tree/master/object detection/birds eye viewer"
    click ODCD "https://github.com/stereolabs/zed-sdk/tree/master/object detection/concurrent detections"
    click ODCU "https://github.com/stereolabs/zed-sdk/tree/master/object detection/custom detector"
    click ODI "https://github.com/stereolabs/zed-sdk/tree/master/object detection/image viewer"
    click ODMC "https://github.com/stereolabs/zed-sdk/tree/master/object detection/multi-camera"
    click PDM "https://github.com/stereolabs/zed-sdk/tree/master/plane detection/plane detection"
    click PDFP "https://github.com/stereolabs/zed-sdk/tree/master/plane detection/floor plane"
    click PTCore "https://github.com/stereolabs/zed-sdk/tree/master/positional tracking/positional tracking"
    click PTFBX "https://github.com/stereolabs/zed-sdk/tree/master/positional tracking/export/fbx"
    click SMCore "https://github.com/stereolabs/zed-sdk/tree/master/spatial mapping/spatial mapping"
    click SMMC "https://github.com/stereolabs/zed-sdk/tree/master/spatial mapping/multi camera"
    click CCS "https://github.com/stereolabs/zed-sdk/tree/master/camera control"
    click CSS "https://github.com/stereolabs/zed-sdk/tree/master/camera streaming/sender"
    click CSR "https://github.com/stereolabs/zed-sdk/tree/master/camera streaming/receiver"
    click RC "https://github.com/stereolabs/zed-sdk/tree/master/recording/recording"
    click RP "https://github.com/stereolabs/zed-sdk/tree/master/recording/playback"
    click RE "https://github.com/stereolabs/zed-sdk/tree/master/recording/export"
    click GLLive "https://github.com/stereolabs/zed-sdk/tree/master/global localization/live"
    click GLPlay "https://github.com/stereolabs/zed-sdk/tree/master/global localization/playback"
    click GLRec "https://github.com/stereolabs/zed-sdk/tree/master/global localization/recording"
    click GLMap "https://github.com/stereolabs/zed-sdk/tree/master/global localization/map server"
    click ZOS "https://github.com/stereolabs/zed-sdk/tree/master/zed one"
    click Tuts "https://github.com/stereolabs/zed-sdk/tree/master/tutorials"

    %% Styles
    classDef hardware fill:#d3d3d3,stroke:#333,stroke-width:1px
    classDef core fill:#2f4f4f,stroke:#000,stroke-width:2px,color:#fff
    classDef binding fill:#add8e6,stroke:#029,stroke-width:1px
    classDef feature fill:#90ee90,stroke:#060,stroke-width:1px
    classDef exporter fill:#ffa500,stroke:#a60,stroke-width:1px
    classDef external fill:#d3d3d3,stroke:#333,stroke-width:1px
    classDef network stroke-dasharray: 5 5,stroke:#999,fill:none
```
