# adityamwagh/superslam architecture

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

- Interactive diagram: https://gitdiagram.com/adityamwagh/superslam
- Repository: https://github.com/adityamwagh/superslam

## Overview

##### Project Type and Purpose
- SuperSLAM is a computer vision / robotics application focused on visual Simultaneous Localization and Mapping (SLAM) using a combination of deep learning (for keypoint detection and matching) and classical SLAM techniques.

##### Main Components (Modules)
- Input Sensors: Represent different types of input streams (monocular, stereo, RGB-D) as the entry point of camera frames.
- Preprocessing and Feature Extraction:
- SuperPoint: Highlight the module responsible for detecting and describing keypoints.
- ORB (traditional) components may also be included due to the ORB_SLAM2 heritage.
- Matching:
- SuperGlue: The module for robust feature matching between frames.
- SPMatcher / ORBMatcher (as seen in include and src directories) can also be represented.
- SLAM Core Pipeline:
- Tracking: Handles frame-to-frame pose estimation (include/Tracking.cc / src/Tracking.cc).
- Local Mapping and Keyframe Management: Includes modules like LocalMapping, KeyFrame, KeyFrameDatabase, and Map.
- Loop Closing: For error correction and map optimization.
- Global Optimization: Typically encapsulated by the Optimizer and possibly using g2o from thirdparty.
- Visualization:
- Viewers (Viewer, FrameDrawer, MapDrawer) for real-time feedback.
- External Dependencies and Libraries:
- Third-party libraries, such as DBoW2/DBoW3 (for bag-of-words visual vocabulary matching) and g2o (for graph optimization), should be represented as supporting components.
- TensorRT / tensorrtbuffer components to indicate the deep learning inference acceleration.
- Example Applications:

##### Relationships and Interactions
- Start from “Sensor/Captured Frames” leading to the “Preprocessing/Feature Extraction” module.
- That the output of matching and tracking feeds into “Local Mapping & Keyframe Insertion,” which then connects with “Loop Closing” to ensure global consistency.
- Integrate “Optimizer” (possibly enhanced by g2o) to further refine the camera trajectory and map.
- That the “Visualization” components read information from the map and tracking modules.

##### Architectural Patterns and Key Design Principles
- Modularity: Show that the system is separated into layers (Input ➔ Feature Extraction ➔ Matching/Tracking ➔ Mapping/Loop Closing ➔ Optimization and Visualization).
- The combination of deep learning and classical approaches should be clearly highlighted.
- That the design leverages thirdparty libraries for specific tasks (e.g., DBoW for visual vocabulary and g2o for optimization).
- For the examples directory, a microservice-like mindset is applied (each example executable is a self-contained application scenario).

##### Overall Detailed Structure
- Underneath, show “Example Applications” as endpoints that utilize the core system (e.g., mono_tum, stereo_euroc).

Happy diagramming!

## Diagram (Mermaid)

```mermaid
flowchart TD

    %% Example Applications
    subgraph "Example Applications"
        MEX_MONO("Monocular")
        MEX_STEREO("Stereo")
        MEX_RGBD("RGB-D")
        MEX_ROS("ROS")
    end

    %% Core SLAM System
    subgraph "Core SLAM System"
        CameraInput("Camera Input")
        
        subgraph "Feature Extraction"
            SuperPoint("SuperPoint Module")
            ORBExtraction("ORB Extraction")
        end
        
        subgraph "Matching"
            SuperGlue("SuperGlue Module")
            SPMatcher("SPMatcher")
        end
        
        Tracking("Tracking")
        LocalMapping("Local Mapping & Keyframes")
        LoopClosing("Loop Closing")
        GlobalOpt("Global Optimization")
        Visualization("Visualization")
    end

    %% External Dependencies
    subgraph "External Dependencies"
        DBoW2("DBoW2")
        DBoW3("DBoW3")
        G2O("g2o")
        TensorRT("TensorRT Support")
    end

    %% Utilities
    subgraph "Utilities"
        ConvertONNX("convert2ONNX")
    end

    %% Connections from Example Applications to Camera Input
    MEX_MONO --> CameraInput
    MEX_STEREO --> CameraInput
    MEX_RGBD --> CameraInput
    MEX_ROS --> CameraInput

    %% Connections within Core SLAM System
    CameraInput --> SuperPoint
    CameraInput --> ORBExtraction

    SuperPoint --> SuperGlue
    SuperPoint --> SPMatcher
    SuperPoint --> Tracking
    ORBExtraction --> Tracking

    SuperGlue --> LocalMapping
    SPMatcher --> LocalMapping
    Tracking --> LocalMapping

    LocalMapping --> LoopClosing
    LoopClosing -- "feedback" --> LocalMapping
    LocalMapping --> GlobalOpt
    GlobalOpt --> Visualization
    Tracking --> Visualization

    %% External Dependencies Connections
    TensorRT -->|"dependency"| SuperPoint
    TensorRT -->|"dependency"| SuperGlue
    DBoW2 -->|"dependency"| LocalMapping
    DBoW3 -->|"dependency"| LocalMapping
    G2O -->|"dependency"| GlobalOpt

    %% Utilities Connections
    ConvertONNX -->|"conversion"| SuperPoint
    ConvertONNX -->|"conversion"| SuperGlue

    %% Click Events
    click MEX_MONO "https://github.com/adityamwagh/superslam/tree/main/examples/monocular"
    click MEX_STEREO "https://github.com/adityamwagh/superslam/tree/main/examples/stereo"
    click MEX_RGBD "https://github.com/adityamwagh/superslam/tree/main/examples/RGB-D"
    click MEX_ROS "https://github.com/adityamwagh/superslam/tree/main/examples/ROS"
    click SuperPoint "https://github.com/adityamwagh/superslam/blob/main/include/SuperPointTRT.h"
    click ORBExtraction "https://github.com/adityamwagh/superslam/blob/main/include/ORBExtractor.h"
    click SuperGlue "https://github.com/adityamwagh/superslam/blob/main/include/SuperGlueTRT.h"
    click SPMatcher "https://github.com/adityamwagh/superslam/blob/main/include/SPMatcher.h"
    click Tracking "https://github.com/adityamwagh/superslam/blob/main/include/Tracking.h"
    click LocalMapping "https://github.com/adityamwagh/superslam/blob/main/include/LocalMapping.h"
    click LoopClosing "https://github.com/adityamwagh/superslam/blob/main/include/LoopClosing.h"
    click GlobalOpt "https://github.com/adityamwagh/superslam/blob/main/include/Optimizer.h"
    click Visualization "https://github.com/adityamwagh/superslam/blob/main/include/Viewer.h"
    click DBoW2 "https://github.com/adityamwagh/superslam/tree/main/thirdparty/DBoW2"
    click DBoW3 "https://github.com/adityamwagh/superslam/tree/main/thirdparty/DBoW3"
    click G2O "https://github.com/adityamwagh/superslam/tree/main/thirdparty/g2o"
    click TensorRT "https://github.com/adityamwagh/superslam/tree/main/thirdparty/tensorrtbuffer"
    click ConvertONNX "https://github.com/adityamwagh/superslam/tree/main/utils/convert2onnx"

    %% Styles
    classDef sensor fill:#a8d0e6,stroke:#333,stroke-width:2px;
    classDef core fill:#f76c6c,stroke:#333,stroke-width:2px;
    classDef external fill:#fce38a,stroke:#333,stroke-width:2px;
    classDef util fill:#b3de0a,stroke:#333,stroke-width:2px;

    class MEX_MONO,MEX_STEREO,MEX_RGBD,MEX_ROS,CameraInput sensor;
    class SuperPoint,ORBExtraction,SuperGlue,SPMatcher,Tracking,LocalMapping,LoopClosing,GlobalOpt,Visualization core;
    class DBoW2,DBoW3,G2O,TensorRT external;
    class ConvertONNX util;
```
