# gyumingim/stereodepthseg architecture

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

- Interactive diagram: https://gitdiagram.com/gyumingim/stereodepthseg
- Repository: https://github.com/gyumingim/stereodepthseg

## Overview

Camera is a phone-stereo capture and computer-vision repository: the documented workflow captures paired phone video, rectifies the images, estimates dense depth, detects objects, and presents RGB/depth/point-cloud/IMU results. It also contains a broader scan3d application for recording, synchronization, VIO, mapping, replay, and web viewing. The graph uses README statements and SOURCE INDEX references for unsampled modules; those references establish dependencies, not necessarily runtime call details.

Main entry points: [`scan3d/scan3d.py`](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/scan3d.py) (Scan orchestrator), [`z_phone_stereo.py`](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/z_phone_stereo.py) (Phone stereo workflow), [`scan3d/web_server.py`](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/web_server.py) (Web viewer), [`z_object_depth.py`](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/z_object_depth.py) (Object depth and size)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_phone["Phone capture"]
  node_phone_app["Phone camera app<br/>[MainActivity.java]"]
  node_capture_sync["Capture synchronization<br/>[PhaseSync.java]"]
  node_phone_upload["Recording upload<br/>[UploadService.java]"]
  node_phone_link["Phone link<br/>[phone_link.py]"]
  node_phone_rx["Phone receiver<br/>[phone_rx.py]"]
end

subgraph group_vision["Stereo vision"]
  node_calibration["Camera calibration<br/>[lib_calib.py]"]
  node_phone_calibration["Phone calibration<br/>[lib_phone_calib.py]"]
  node_rectification["Stereo rectification<br/>[lib_rectify.py]"]
  node_stereo_core["Stereo geometry<br/>[lib_stereo.py]"]
  node_depth_model["Dense depth inference<br/>[lib_ffs.py]"]
  node_detection["Object detection<br/>[lib_detect.py]"]
  node_object_depth["Object depth and size<br/>[z_object_depth.py]"]
  node_live_stereo["Phone stereo workflow<br/>[z_phone_stereo.py]"]
end

subgraph group_scan["Scan processing"]
  node_scan_app["Scan orchestrator<br/>[scan3d.py]"]
  node_frame_data["Frame handling<br/>[frames.py]"]
  node_record_sync["Recording synchronization<br/>[rec_sync.py]"]
  node_motion_rect["Motion rectification<br/>[motion_rect.py]"]
  node_vio_client["OpenVINS client<br/>[ov_client.py]"]
  node_aruco_scale["Marker scale estimation<br/>[aruco_scale.py]"]
end

subgraph group_maps["Mapping and viewing"]
  node_depth_fusion["Depth fusion<br/>[depth_fuse.py]"]
  node_voxel_map[("Voxel mapping<br/>[voxel_map.py]")]
  node_tsdf_map[("TSDF mapping<br/>[tsdf_map.py]")]
  node_esdf_map[("ESDF mapping<br/>[esdf_map.py]")]
  node_replay_view["Replay viewer<br/>[replay_view.py]"]
  node_web_view["Web viewer<br/>[web_server.py]"]
  node_rgbd_view["RGB-D viewer<br/>[lib_rgbd_viewer.py]"]
  node_pointcloud["Point-cloud tools"]
end

node_user(("Operator"))

node_user -->|"starts capture"| node_phone_app
node_phone_app -->|"uses sync"| node_capture_sync
node_phone_app -.->|"uploads recordings"| node_phone_upload
node_user -->|"runs workflow"| node_live_stereo
node_live_stereo -->|"loads calibration"| node_phone_calibration
node_phone_calibration -->|"builds geometry"| node_rectification
node_live_stereo -.->|"rectifies pairs"| node_rectification
node_live_stereo -.->|"estimates depth"| node_depth_model
node_live_stereo -.->|"detects objects"| node_detection
node_object_depth -->|"runs detection"| node_detection
node_object_depth -->|"rectifies images"| node_rectification
node_object_depth -->|"reconstructs points"| node_stereo_core
node_stereo_core -->|"finds corners"| node_calibration
node_user -->|"runs scan"| node_scan_app
node_scan_app -->|"uses frames"| node_frame_data
node_scan_app -->|"uses phone link"| node_phone_link
node_scan_app -->|"uses receiver"| node_phone_rx
node_scan_app -->|"uses sync"| node_record_sync
node_scan_app -->|"uses rectification"| node_motion_rect
node_scan_app -->|"uses VIO client"| node_vio_client
node_scan_app -->|"uses scale estimation"| node_aruco_scale
node_scan_app -->|"uses voxel map"| node_voxel_map
node_scan_app -->|"uses replay viewer"| node_replay_view
node_scan_app -->|"uses web server"| node_web_view
node_web_view -->|"loads map code"| node_voxel_map
node_web_view -->|"loads map code"| node_tsdf_map
node_web_view -->|"loads map code"| node_esdf_map
node_scan_app -.->|"fuses depth"| node_depth_fusion
node_scan_app -.->|"builds map"| node_tsdf_map
node_scan_app -.->|"presents RGB-D"| node_rgbd_view
node_scan_app -.->|"presents point cloud"| node_pointcloud

click node_phone_app "https://github.com/gyumingim/stereodepthseg/blob/gyumingim/phone_stereo/android/src/com/camera/dualstream/MainActivity.java"
click node_capture_sync "https://github.com/gyumingim/stereodepthseg/blob/gyumingim/phone_stereo/android/src/com/camera/dualstream/PhaseSync.java"
click node_phone_upload "https://github.com/gyumingim/stereodepthseg/blob/gyumingim/phone_stereo/android/src/com/camera/dualstream/UploadService.java"
click node_phone_link "https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/phone_link.py"
click node_phone_rx "https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/phone_rx.py"
click node_calibration "https://github.com/gyumingim/stereodepthseg/blob/gyumingim/lib_calib.py"
click node_phone_calibration "https://github.com/gyumingim/stereodepthseg/blob/gyumingim/lib_phone_calib.py"
click node_rectification "https://github.com/gyumingim/stereodepthseg/blob/gyumingim/lib_rectify.py"
click node_stereo_core "https://github.com/gyumingim/stereodepthseg/blob/gyumingim/lib_stereo.py"
click node_depth_model "https://github.com/gyumingim/stereodepthseg/blob/gyumingim/lib_ffs.py"
click node_detection "https://github.com/gyumingim/stereodepthseg/blob/gyumingim/lib_detect.py"
click node_object_depth "https://github.com/gyumingim/stereodepthseg/blob/gyumingim/z_object_depth.py"
click node_live_stereo "https://github.com/gyumingim/stereodepthseg/blob/gyumingim/z_phone_stereo.py"
click node_scan_app "https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/scan3d.py"
click node_frame_data "https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/frames.py"
click node_record_sync "https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/rec_sync.py"
click node_motion_rect "https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/motion_rect.py"
click node_vio_client "https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/ov_client.py"
click node_aruco_scale "https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/aruco_scale.py"
click node_depth_fusion "https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/depth_fuse.py"
click node_voxel_map "https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/voxel_map.py"
click node_tsdf_map "https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/tsdf_map.py"
click node_esdf_map "https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/esdf_map.py"
click node_replay_view "https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/replay_view.py"
click node_web_view "https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/web_server.py"
click node_rgbd_view "https://github.com/gyumingim/stereodepthseg/blob/gyumingim/lib_rgbd_viewer.py"
click node_pointcloud "https://github.com/gyumingim/stereodepthseg/blob/gyumingim/lib_pointcloud_view.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_phone_app,node_capture_sync,node_phone_upload,node_phone_link,node_phone_rx toneBlue
class node_calibration,node_phone_calibration,node_rectification,node_stereo_core,node_depth_model,node_detection,node_object_depth,node_live_stereo toneAmber
class node_scan_app,node_frame_data,node_record_sync,node_motion_rect,node_vio_client,node_aruco_scale toneMint
class node_depth_fusion,node_voxel_map,node_tsdf_map,node_esdf_map,node_replay_view,node_web_view,node_rgbd_view,node_pointcloud toneRose
class node_user toneIndigo
```

## Components

### Phone capture

- [Phone camera app](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/phone_stereo/android/src/com/camera/dualstream/MainActivity.java): `phone_stereo/android/src/com/camera/dualstream/MainActivity.java`
- [Capture synchronization](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/phone_stereo/android/src/com/camera/dualstream/PhaseSync.java): `phone_stereo/android/src/com/camera/dualstream/PhaseSync.java`
- [Recording upload](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/phone_stereo/android/src/com/camera/dualstream/UploadService.java): `phone_stereo/android/src/com/camera/dualstream/UploadService.java`
- [Phone link](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/phone_link.py): `scan3d/phone_link.py`
- [Phone receiver](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/phone_rx.py): `scan3d/phone_rx.py`

### Stereo vision

- [Camera calibration](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/lib_calib.py): `lib_calib.py`
- [Phone calibration](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/lib_phone_calib.py): `lib_phone_calib.py`
- [Stereo rectification](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/lib_rectify.py): `lib_rectify.py`
- [Stereo geometry](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/lib_stereo.py): `lib_stereo.py`
- [Dense depth inference](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/lib_ffs.py): `lib_ffs.py`
- [Object detection](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/lib_detect.py): `lib_detect.py`
- [Object depth and size](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/z_object_depth.py): `z_object_depth.py`
- [Phone stereo workflow](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/z_phone_stereo.py): `z_phone_stereo.py`

### Scan processing

- [Scan orchestrator](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/scan3d.py): `scan3d/scan3d.py`
- [Frame handling](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/frames.py): `scan3d/frames.py`
- [Recording synchronization](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/rec_sync.py): `scan3d/rec_sync.py`
- [Motion rectification](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/motion_rect.py): `scan3d/motion_rect.py`
- [OpenVINS client](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/ov_client.py): `scan3d/ov_client.py`
- [Marker scale estimation](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/aruco_scale.py): `scan3d/aruco_scale.py`

### Mapping and viewing

- [Depth fusion](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/depth_fuse.py): `scan3d/depth_fuse.py`
- [Voxel mapping](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/voxel_map.py): `scan3d/voxel_map.py`
- [TSDF mapping](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/tsdf_map.py): `scan3d/tsdf_map.py`
- [ESDF mapping](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/esdf_map.py): `scan3d/esdf_map.py`
- [Replay viewer](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/replay_view.py): `scan3d/replay_view.py`
- [Web viewer](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/scan3d/web_server.py): `scan3d/web_server.py`
- [RGB-D viewer](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/lib_rgbd_viewer.py): `lib_rgbd_viewer.py`
- [Point-cloud tools](https://github.com/gyumingim/stereodepthseg/blob/gyumingim/lib_pointcloud_view.py): `lib_pointcloud_view.py`

### Other components

- **Operator**

## Connections

- Operator → Phone camera app: starts capture
- Phone camera app → Capture synchronization: uses sync (evidence: `phone_stereo/android/src/com/camera/dualstream/MainActivity.java`)
- Phone camera app → Recording upload: uploads recordings (evidence: `phone_stereo/android/src/com/camera/dualstream/MainActivity.java`)
- Operator → Phone stereo workflow: runs workflow
- Phone stereo workflow → Phone calibration: loads calibration
- Phone calibration → Stereo rectification: builds geometry
- Phone stereo workflow → Stereo rectification: rectifies pairs
- Phone stereo workflow → Dense depth inference: estimates depth
- Phone stereo workflow → Object detection: detects objects
- Object depth and size → Object detection: runs detection (evidence: `z_object_depth.py`)
- Object depth and size → Stereo rectification: rectifies images (evidence: `z_object_depth.py`)
- Object depth and size → Stereo geometry: reconstructs points (evidence: `z_object_depth.py`)
- Stereo geometry → Camera calibration: finds corners (evidence: `lib_stereo.py`)
- Operator → Scan orchestrator: runs scan (evidence: `scan3d/scan3d.py`)
- Scan orchestrator → Frame handling: uses frames (evidence: `scan3d/scan3d.py`)
- Scan orchestrator → Phone link: uses phone link (evidence: `scan3d/scan3d.py`)
- Scan orchestrator → Phone receiver: uses receiver (evidence: `scan3d/scan3d.py`)
- Scan orchestrator → Recording synchronization: uses sync (evidence: `scan3d/scan3d.py`)
- Scan orchestrator → Motion rectification: uses rectification (evidence: `scan3d/scan3d.py`)
- Scan orchestrator → OpenVINS client: uses VIO client (evidence: `scan3d/scan3d.py`)
- Scan orchestrator → Marker scale estimation: uses scale estimation (evidence: `scan3d/scan3d.py`)
- Scan orchestrator → Voxel mapping: uses voxel map (evidence: `scan3d/scan3d.py`)
- Scan orchestrator → Replay viewer: uses replay viewer (evidence: `scan3d/scan3d.py`)
- Scan orchestrator → Web viewer: uses web server (evidence: `scan3d/scan3d.py`)
- Web viewer → Voxel mapping: loads map code (evidence: `scan3d/web_server.py`)
- Web viewer → TSDF mapping: loads map code (evidence: `scan3d/web_server.py`)
- Web viewer → ESDF mapping: loads map code (evidence: `scan3d/web_server.py`)
- Scan orchestrator → Depth fusion: fuses depth (evidence: `scan3d/scan3d.py`)
- Scan orchestrator → TSDF mapping: builds map
- Scan orchestrator → RGB-D viewer: presents RGB-D
- Scan orchestrator → Point-cloud tools: presents point cloud
