# m33i/slam architecture

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

- Interactive diagram: https://gitdiagram.com/m33i/slam
- Repository: https://github.com/m33i/slam

## Overview

This is a lightweight monocular visual-SLAM application: a user supplies a video, the runtime estimates camera motion from successive frames, builds a 3D point cloud and trajectory, and visualizes the results. The main control flow is in `slam.py`; feature matching and pose estimation are in `feat_extractor.py`, while map construction and rendering are in `mapping.py`. README-described options include ORB detection, image-region masking, point colors, and keyframe frustums. The sampled source supports the main runtime connections; those options are represented where their implementation is visible.

Main entry points: [`slam.py`](https://github.com/m33i/slam/blob/master/slam.py) (SLAM Orchestrator), [`mapping.py`](https://github.com/m33i/slam/blob/master/mapping.py) (Map and Trajectory), [`display.py`](https://github.com/m33i/slam/blob/master/display.py) (Display and Controls), [`feat_extractor.py`](https://github.com/m33i/slam/blob/master/feat_extractor.py) (Feature and Pose)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["SLAM Runtime"]
  node_slam["SLAM Orchestrator<br/>[slam.py]"]
  node_features["Feature and Pose<br/>[feat_extractor.py]"]
end

subgraph group_mapping["Mapping and Geometry"]
  node_utils["Geometry Utilities<br/>[utils.py]"]
  node_mapping_core["Map and Trajectory<br/>[mapping.py]"]
end

subgraph group_ui["Visualization and Controls"]
  node_display["Display and Controls<br/>[display.py]"]
end

node_user(("User"))
node_video["Input Video"]
node_opencv["OpenCV"]
node_open3d["Open3D"]

node_user -->|"starts with video"| node_slam
node_video -->|"frames read"| node_slam
node_slam -->|"opens and reads video"| node_opencv
node_slam -->|"processes frames"| node_features
node_features -->|"detects and matches"| node_opencv
node_features -->|"requests feature mask"| node_utils
node_slam -->|"samples point colors"| node_utils
node_slam -->|"updates points and pose"| node_mapping_core
node_mapping_core -->|"uses view and keyframe helpers"| node_utils
node_mapping_core -->|"builds and renders map"| node_open3d
node_slam -->|"updates panels"| node_display
node_display -->|"shows UI"| node_opencv
node_slam -->|"checks clicked controls"| node_display
node_slam -->|"closes and saves map"| node_mapping_core
node_mapping_core -->|"sends rendered view"| node_display

click node_slam "https://github.com/m33i/slam/blob/master/slam.py"
click node_features "https://github.com/m33i/slam/blob/master/feat_extractor.py"
click node_utils "https://github.com/m33i/slam/blob/master/utils.py"
click node_mapping_core "https://github.com/m33i/slam/blob/master/mapping.py"
click node_display "https://github.com/m33i/slam/blob/master/display.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_slam,node_features,node_user toneBlue
class node_utils,node_mapping_core toneAmber
class node_display toneMint
class node_video,node_opencv,node_open3d toneIndigo
```

## Components

### SLAM Runtime

- [SLAM Orchestrator](https://github.com/m33i/slam/blob/master/slam.py): `slam.py`
- [Feature and Pose](https://github.com/m33i/slam/blob/master/feat_extractor.py): `feat_extractor.py`

### Mapping and Geometry

- [Geometry Utilities](https://github.com/m33i/slam/blob/master/utils.py): `utils.py`
- [Map and Trajectory](https://github.com/m33i/slam/blob/master/mapping.py): `mapping.py`

### Visualization and Controls

- [Display and Controls](https://github.com/m33i/slam/blob/master/display.py): `display.py`

### Other components

- **User**
- **Input Video**
- **OpenCV**
- **Open3D**

## Connections

- User → SLAM Orchestrator: starts with video
- Input Video → SLAM Orchestrator: frames read
- SLAM Orchestrator → OpenCV: opens and reads video
- SLAM Orchestrator → Feature and Pose: processes frames
- Feature and Pose → OpenCV: detects and matches
- Feature and Pose → Geometry Utilities: requests feature mask
- SLAM Orchestrator → Geometry Utilities: samples point colors
- SLAM Orchestrator → Map and Trajectory: updates points and pose
- Map and Trajectory → Geometry Utilities: uses view and keyframe helpers
- Map and Trajectory → Open3D: builds and renders map
- SLAM Orchestrator → Display and Controls: updates panels
- Display and Controls → OpenCV: shows UI
- SLAM Orchestrator → Display and Controls: checks clicked controls
- SLAM Orchestrator → Map and Trajectory: closes and saves map
- Map and Trajectory → Display and Controls: sends rendered view
