# sanjeev-r-b/blind_navigation architecture

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

- Interactive diagram: https://gitdiagram.com/sanjeev-r-b/blind_navigation
- Repository: https://github.com/sanjeev-r-b/blind_navigation

## Overview

Blind Navigation is an assistive vision app that turns camera frames into obstacle detections, distance/risk estimates, and spoken proximity alerts, with a visual camera/dashboard path. The Android app bridges native camera input to Python postprocessing; the repository also contains a desktop Python detection pipeline and a Phase 2 camera-driven pipeline. The README documents detection, overlays, FPS profiling, resolution tuning, and Android camera integration. Some Android and Phase 2 wiring is unsampled, so uncertain links are omitted or marked unverified.

Main entry points: [`blind_nav/phase2_distance/run_phase2.py`](https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase2_distance/run_phase2.py) (Desktop Phase 2 runner), [`blind_nav/phase1_detection/detection/yolo_detector.py`](https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase1_detection/detection/yolo_detector.py) (YOLO detector), [`android/app/src/main/python/blind_nav/phase2_distance/run_phase2.py`](https://github.com/sanjeev-r-b/blind_navigation/blob/main/android/app/src/main/python/blind_nav/phase2_distance/run_phase2.py) (Android Phase 2 runner), [`android/app/src/main/python/camera_android.py`](https://github.com/sanjeev-r-b/blind_navigation/blob/main/android/app/src/main/python/camera_android.py) (Android Python bridge)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_android["Android App"]
  node_camera["Native camera host<br/>[CameraActivity.kt]"]
  node_overlay["Detection overlay<br/>[OverlayView.kt]"]
  node_androidbridge["Android Python bridge<br/>[camera_android.py]"]
  node_androidphase["Android Phase 2 runner<br/>[run_phase2.py]"]
end

subgraph group_detect["Detection"]
  node_desktopfeed["Desktop camera feed<br/>[camera_feed.py]"]
  node_cambridge["Camera bridge<br/>[camera_android.py]"]
  node_detector["YOLO detector<br/>[yolo_detector.py]"]
  node_onnx["ONNX inference<br/>[onnx_inference.py]"]
  node_renderer["Box renderer<br/>[bbox_renderer.py]"]
  node_fps["FPS counter<br/>[fps_counter.py]"]
  node_tuner["Resolution tuner"]
end

subgraph group_distance["Distance And Risk"]
  node_estimator["Pinhole estimator"]
  node_calibration["Calibration data<br/>[calibration.json]"]
  node_depth["Depth estimation<br/>[depth_anything.py]"]
  node_fusion["Depth fusion<br/>[depth_fusion.py]"]
  node_clip["Frame clipping check<br/>[clip_detector.py]"]
  node_runner["Desktop Phase 2 runner<br/>[run_phase2.py]"]
end

subgraph group_output["Feedback"]
  node_formatter["Alert formatter<br/>[alert_formatter.py]"]
  node_tts["Speech engine<br/>[tts_engine.py]"]
  node_speaker(("Device audio"))
  node_screen(("Device display"))
end

node_user(("Blind-navigation user"))

node_user -.->|"starts camera"| node_camera
node_camera -.->|"bridges frames"| node_androidbridge
node_androidbridge -->|"delegates detection"| node_detector
node_androidbridge -->|"estimates distance"| node_estimator
node_androidbridge -->|"formats alerts"| node_formatter
node_androidbridge -.->|"supplies detections"| node_overlay
node_desktopfeed -->|"detects objects"| node_detector
node_desktopfeed -->|"renders boxes"| node_renderer
node_desktopfeed -->|"measures rate"| node_fps
node_tuner -->|"benchmarks input"| node_detector
node_detector -->|"runs inference"| node_onnx
node_runner -->|"detects objects"| node_detector
node_runner -->|"estimates distances"| node_estimator
node_runner -->|"checks clipping"| node_clip
node_runner -->|"formats alerts"| node_formatter
node_runner -->|"queues speech"| node_tts
node_runner -->|"renders frame"| node_renderer
node_runner -->|"measures rate"| node_fps
node_estimator -->|"loads calibration"| node_calibration
node_fusion -->|"runs depth model"| node_depth
node_androidphase -.->|"uses detector"| node_detector
node_androidphase -.->|"estimates distances"| node_estimator
node_androidphase -.->|"checks clipping"| node_clip
node_androidphase -.->|"formats alerts"| node_formatter
node_androidphase -.->|"queues speech"| node_tts
node_tts -.->|"speaks alerts"| node_speaker
node_runner -->|"shows dashboard"| node_screen
node_user -.->|"views feedback"| node_screen

click node_camera "https://github.com/sanjeev-r-b/blind_navigation/blob/main/android/app/src/main/java/com/example/blindnav/CameraActivity.kt"
click node_overlay "https://github.com/sanjeev-r-b/blind_navigation/blob/main/android/app/src/main/java/com/example/blindnav/OverlayView.kt"
click node_androidbridge "https://github.com/sanjeev-r-b/blind_navigation/blob/main/android/app/src/main/python/camera_android.py"
click node_androidphase "https://github.com/sanjeev-r-b/blind_navigation/blob/main/android/app/src/main/python/blind_nav/phase2_distance/run_phase2.py"
click node_desktopfeed "https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase1_detection/camera/camera_feed.py"
click node_cambridge "https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase1_detection/camera/camera_android.py"
click node_detector "https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase1_detection/detection/yolo_detector.py"
click node_onnx "https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase1_detection/detection/onnx_inference.py"
click node_renderer "https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase1_detection/detection/bbox_renderer.py"
click node_fps "https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase1_detection/utils/fps_counter.py"
click node_tuner "https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase1_detection/utils/resolution_tuner.py"
click node_estimator "https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase2_distance/distance/pinhole_estimator.py"
click node_calibration "https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase2_distance/distance/calibration.json"
click node_depth "https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase2_distance/depth/depth_anything.py"
click node_fusion "https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase2_distance/depth/depth_fusion.py"
click node_clip "https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase2_distance/utils/clip_detector.py"
click node_runner "https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase2_distance/run_phase2.py"
click node_formatter "https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase2_distance/audio/alert_formatter.py"
click node_tts "https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase2_distance/audio/tts_engine.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_camera,node_overlay,node_androidbridge,node_androidphase,node_user toneBlue
class node_desktopfeed,node_cambridge,node_detector,node_onnx,node_renderer,node_fps,node_tuner toneAmber
class node_estimator,node_calibration,node_depth,node_fusion,node_clip,node_runner toneMint
class node_formatter,node_tts,node_speaker,node_screen toneRose
```

## Components

### Android App

- [Native camera host](https://github.com/sanjeev-r-b/blind_navigation/blob/main/android/app/src/main/java/com/example/blindnav/CameraActivity.kt): `android/app/src/main/java/com/example/blindnav/CameraActivity.kt`
- [Detection overlay](https://github.com/sanjeev-r-b/blind_navigation/blob/main/android/app/src/main/java/com/example/blindnav/OverlayView.kt): `android/app/src/main/java/com/example/blindnav/OverlayView.kt`
- [Android Python bridge](https://github.com/sanjeev-r-b/blind_navigation/blob/main/android/app/src/main/python/camera_android.py): `android/app/src/main/python/camera_android.py`
- [Android Phase 2 runner](https://github.com/sanjeev-r-b/blind_navigation/blob/main/android/app/src/main/python/blind_nav/phase2_distance/run_phase2.py): `android/app/src/main/python/blind_nav/phase2_distance/run_phase2.py`

### Detection

- [Desktop camera feed](https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase1_detection/camera/camera_feed.py): `blind_nav/phase1_detection/camera/camera_feed.py`
- [Camera bridge](https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase1_detection/camera/camera_android.py): `blind_nav/phase1_detection/camera/camera_android.py`
- [YOLO detector](https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase1_detection/detection/yolo_detector.py): `blind_nav/phase1_detection/detection/yolo_detector.py`
- [ONNX inference](https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase1_detection/detection/onnx_inference.py): `blind_nav/phase1_detection/detection/onnx_inference.py`
- [Box renderer](https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase1_detection/detection/bbox_renderer.py): `blind_nav/phase1_detection/detection/bbox_renderer.py`
- [FPS counter](https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase1_detection/utils/fps_counter.py): `blind_nav/phase1_detection/utils/fps_counter.py`
- [Resolution tuner](https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase1_detection/utils/resolution_tuner.py): `blind_nav/phase1_detection/utils/resolution_tuner.py`

### Distance And Risk

- [Pinhole estimator](https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase2_distance/distance/pinhole_estimator.py): `blind_nav/phase2_distance/distance/pinhole_estimator.py`
- [Calibration data](https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase2_distance/distance/calibration.json): `blind_nav/phase2_distance/distance/calibration.json`
- [Depth estimation](https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase2_distance/depth/depth_anything.py): `blind_nav/phase2_distance/depth/depth_anything.py`
- [Depth fusion](https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase2_distance/depth/depth_fusion.py): `blind_nav/phase2_distance/depth/depth_fusion.py`
- [Frame clipping check](https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase2_distance/utils/clip_detector.py): `blind_nav/phase2_distance/utils/clip_detector.py`
- [Desktop Phase 2 runner](https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase2_distance/run_phase2.py): `blind_nav/phase2_distance/run_phase2.py`

### Feedback

- [Alert formatter](https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase2_distance/audio/alert_formatter.py): `blind_nav/phase2_distance/audio/alert_formatter.py`
- [Speech engine](https://github.com/sanjeev-r-b/blind_navigation/blob/main/blind_nav/phase2_distance/audio/tts_engine.py): `blind_nav/phase2_distance/audio/tts_engine.py`
- **Device audio**
- **Device display**

### Other components

- **Blind-navigation user**

## Connections

- Blind-navigation user → Native camera host: starts camera (evidence: `README.md`)
- Native camera host → Android Python bridge: bridges frames (evidence: `android/app/src/main/python/camera_android.py`)
- Android Python bridge → YOLO detector: delegates detection (evidence: `android/app/src/main/python/camera_android.py`)
- Android Python bridge → Pinhole estimator: estimates distance (evidence: `android/app/src/main/python/camera_android.py`)
- Android Python bridge → Alert formatter: formats alerts (evidence: `android/app/src/main/python/camera_android.py`)
- Android Python bridge → Detection overlay: supplies detections
- Desktop camera feed → YOLO detector: detects objects (evidence: `blind_nav/phase1_detection/camera/camera_feed.py`)
- Desktop camera feed → Box renderer: renders boxes (evidence: `blind_nav/phase1_detection/camera/camera_feed.py`)
- Desktop camera feed → FPS counter: measures rate (evidence: `blind_nav/phase1_detection/camera/camera_feed.py`)
- Resolution tuner → YOLO detector: benchmarks input (evidence: `blind_nav/phase1_detection/utils/resolution_tuner.py`)
- YOLO detector → ONNX inference: runs inference (evidence: `blind_nav/phase1_detection/detection/yolo_detector.py`)
- Desktop Phase 2 runner → YOLO detector: detects objects (evidence: `blind_nav/phase2_distance/run_phase2.py`)
- Desktop Phase 2 runner → Pinhole estimator: estimates distances (evidence: `blind_nav/phase2_distance/run_phase2.py`)
- Desktop Phase 2 runner → Frame clipping check: checks clipping (evidence: `blind_nav/phase2_distance/run_phase2.py`)
- Desktop Phase 2 runner → Alert formatter: formats alerts (evidence: `blind_nav/phase2_distance/run_phase2.py`)
- Desktop Phase 2 runner → Speech engine: queues speech (evidence: `blind_nav/phase2_distance/run_phase2.py`)
- Desktop Phase 2 runner → Box renderer: renders frame (evidence: `blind_nav/phase2_distance/run_phase2.py`)
- Desktop Phase 2 runner → FPS counter: measures rate (evidence: `blind_nav/phase2_distance/run_phase2.py`)
- Pinhole estimator → Calibration data: loads calibration (evidence: `blind_nav/phase2_distance/distance/pinhole_estimator.py`)
- Depth fusion → Depth estimation: runs depth model (evidence: `blind_nav/phase2_distance/depth/depth_fusion.py`)
- Android Phase 2 runner → YOLO detector: uses detector (evidence: `android/app/src/main/python/blind_nav/phase2_distance/run_phase2.py`)
- Android Phase 2 runner → Pinhole estimator: estimates distances (evidence: `android/app/src/main/python/blind_nav/phase2_distance/run_phase2.py`)
- Android Phase 2 runner → Frame clipping check: checks clipping (evidence: `android/app/src/main/python/blind_nav/phase2_distance/run_phase2.py`)
- Android Phase 2 runner → Alert formatter: formats alerts (evidence: `android/app/src/main/python/blind_nav/phase2_distance/run_phase2.py`)
- Android Phase 2 runner → Speech engine: queues speech (evidence: `android/app/src/main/python/blind_nav/phase2_distance/run_phase2.py`)
- Speech engine → Device audio: speaks alerts (evidence: `blind_nav/phase2_distance/audio/tts_engine.py`)
- Desktop Phase 2 runner → Device display: shows dashboard (evidence: `blind_nav/phase2_distance/run_phase2.py`)
- Blind-navigation user → Device display: views feedback (evidence: `README.md`)
