# abhijitmahalle/lane-detection architecture

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

- Interactive diagram: https://gitdiagram.com/abhijitmahalle/lane-detection
- Repository: https://github.com/abhijitmahalle/lane-detection

## Overview

This repository implements two standalone classical-computer-vision workflows: straight-road solid/dashed line detection and curved-road lane fitting with curvature and turn estimation. A user runs either script; it reads video frames, processes them, and writes annotated video. The straight workflow is explicit in its source. The curved workflow’s README documents the detection stages, while its excerpt shows the frame loop and final assembly but omits several intermediate calls; those links are therefore documented rather than inferred from imports. Input and output filenames differ between the tree and source, so they are not linked to specific assets.

Main entry points: [`code/curved_lane_detection.py`](https://github.com/abhijitmahalle/lane-detection/blob/master/code/curved_lane_detection.py) (Curved Workflow), [`code/straight_lane_detection.py`](https://github.com/abhijitmahalle/lane-detection/blob/master/code/straight_lane_detection.py) (Straight Workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_straight["Straight Lane Detection"]
  node_straight_runner["Straight Workflow"]
  node_straight_preprocess["Threshold Frames"]
  node_straight_roi["Select Road ROI"]
  node_straight_lines["Detect Lane Lines"]
  node_straight_draw["Draw Lane Lines"]
end

subgraph group_curved["Curved Lane Detection"]
  node_curved_runner["Curved Workflow"]
  node_curve_preprocess["Lane Preprocessing"]
  node_curve_warp["Perspective Warp"]
  node_curve_fit["Lane Curve Fit"]
  node_curve_overlay["Lane Overlay"]
  node_curvature["Curvature Estimate"]
  node_turn["Turn Prediction"]
  node_presentation["Result Assembly"]
end

subgraph group_video["Video I/O"]
  node_video_source["Input Video"]
  node_video_output["Annotated Video"]
end

node_user(("User"))

node_user -->|"runs"| node_straight_runner
node_user -->|"runs"| node_curved_runner
node_video_source -->|"provides frames"| node_straight_runner
node_straight_runner -->|"preprocesses"| node_straight_preprocess
node_straight_runner -->|"masks region"| node_straight_roi
node_straight_runner -->|"detects lines"| node_straight_lines
node_straight_runner -->|"draws results"| node_straight_draw
node_straight_runner -->|"writes frames"| node_video_output
node_video_source -->|"provides frames"| node_curved_runner
node_curved_runner -->|"detects lanes"| node_curve_preprocess
node_curved_runner -->|"warps view"| node_curve_warp
node_curved_runner -->|"fits curves"| node_curve_fit
node_curved_runner -->|"renders lanes"| node_curve_overlay
node_curved_runner -->|"computes radii"| node_curvature
node_curved_runner -->|"predicts turn"| node_turn
node_curved_runner -->|"assembles display"| node_presentation
node_curved_runner -->|"writes frames"| node_video_output

click node_straight_runner "https://github.com/abhijitmahalle/lane-detection/blob/master/code/straight_lane_detection.py"
click node_straight_preprocess "https://github.com/abhijitmahalle/lane-detection/blob/master/code/straight_lane_detection.py"
click node_straight_roi "https://github.com/abhijitmahalle/lane-detection/blob/master/code/straight_lane_detection.py"
click node_straight_lines "https://github.com/abhijitmahalle/lane-detection/blob/master/code/straight_lane_detection.py"
click node_straight_draw "https://github.com/abhijitmahalle/lane-detection/blob/master/code/straight_lane_detection.py"
click node_curved_runner "https://github.com/abhijitmahalle/lane-detection/blob/master/code/curved_lane_detection.py"
click node_curve_preprocess "https://github.com/abhijitmahalle/lane-detection/blob/master/code/curved_lane_detection.py"
click node_curve_warp "https://github.com/abhijitmahalle/lane-detection/blob/master/code/curved_lane_detection.py"
click node_curve_fit "https://github.com/abhijitmahalle/lane-detection/blob/master/code/curved_lane_detection.py"
click node_curve_overlay "https://github.com/abhijitmahalle/lane-detection/blob/master/code/curved_lane_detection.py"
click node_curvature "https://github.com/abhijitmahalle/lane-detection/blob/master/code/curved_lane_detection.py"
click node_turn "https://github.com/abhijitmahalle/lane-detection/blob/master/code/curved_lane_detection.py"
click node_presentation "https://github.com/abhijitmahalle/lane-detection/blob/master/code/curved_lane_detection.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_straight_runner,node_straight_preprocess,node_straight_roi,node_straight_lines,node_straight_draw,node_user toneBlue
class node_curved_runner,node_curve_preprocess,node_curve_warp,node_curve_fit,node_curve_overlay,node_curvature,node_turn,node_presentation toneAmber
class node_video_source,node_video_output toneMint
```

## Components

### Straight Lane Detection

- [Straight Workflow](https://github.com/abhijitmahalle/lane-detection/blob/master/code/straight_lane_detection.py): `code/straight_lane_detection.py`
- [Threshold Frames](https://github.com/abhijitmahalle/lane-detection/blob/master/code/straight_lane_detection.py): `code/straight_lane_detection.py`
- [Select Road ROI](https://github.com/abhijitmahalle/lane-detection/blob/master/code/straight_lane_detection.py): `code/straight_lane_detection.py`
- [Detect Lane Lines](https://github.com/abhijitmahalle/lane-detection/blob/master/code/straight_lane_detection.py): `code/straight_lane_detection.py`
- [Draw Lane Lines](https://github.com/abhijitmahalle/lane-detection/blob/master/code/straight_lane_detection.py): `code/straight_lane_detection.py`

### Curved Lane Detection

- [Curved Workflow](https://github.com/abhijitmahalle/lane-detection/blob/master/code/curved_lane_detection.py): `code/curved_lane_detection.py`
- [Lane Preprocessing](https://github.com/abhijitmahalle/lane-detection/blob/master/code/curved_lane_detection.py): `code/curved_lane_detection.py`
- [Perspective Warp](https://github.com/abhijitmahalle/lane-detection/blob/master/code/curved_lane_detection.py): `code/curved_lane_detection.py`
- [Lane Curve Fit](https://github.com/abhijitmahalle/lane-detection/blob/master/code/curved_lane_detection.py): `code/curved_lane_detection.py`
- [Lane Overlay](https://github.com/abhijitmahalle/lane-detection/blob/master/code/curved_lane_detection.py): `code/curved_lane_detection.py`
- [Curvature Estimate](https://github.com/abhijitmahalle/lane-detection/blob/master/code/curved_lane_detection.py): `code/curved_lane_detection.py`
- [Turn Prediction](https://github.com/abhijitmahalle/lane-detection/blob/master/code/curved_lane_detection.py): `code/curved_lane_detection.py`
- [Result Assembly](https://github.com/abhijitmahalle/lane-detection/blob/master/code/curved_lane_detection.py): `code/curved_lane_detection.py`

### Video I/O

- **Input Video**
- **Annotated Video**

### Other components

- **User**

## Connections

- User → Straight Workflow: runs (evidence: `README.md`)
- User → Curved Workflow: runs (evidence: `README.md`)
- Input Video → Straight Workflow: provides frames (evidence: `code/straight_lane_detection.py`)
- Straight Workflow → Threshold Frames: preprocesses (evidence: `code/straight_lane_detection.py`)
- Straight Workflow → Select Road ROI: masks region (evidence: `code/straight_lane_detection.py`)
- Straight Workflow → Detect Lane Lines: detects lines (evidence: `code/straight_lane_detection.py`)
- Straight Workflow → Draw Lane Lines: draws results (evidence: `code/straight_lane_detection.py`)
- Straight Workflow → Annotated Video: writes frames (evidence: `code/straight_lane_detection.py`)
- Input Video → Curved Workflow: provides frames (evidence: `code/curved_lane_detection.py`)
- Curved Workflow → Lane Preprocessing: detects lanes (evidence: `README.md`)
- Curved Workflow → Perspective Warp: warps view (evidence: `README.md`)
- Curved Workflow → Lane Curve Fit: fits curves (evidence: `README.md`)
- Curved Workflow → Lane Overlay: renders lanes (evidence: `code/curved_lane_detection.py`)
- Curved Workflow → Curvature Estimate: computes radii (evidence: `README.md`)
- Curved Workflow → Turn Prediction: predicts turn (evidence: `code/curved_lane_detection.py`)
- Curved Workflow → Result Assembly: assembles display (evidence: `code/curved_lane_detection.py`)
- Curved Workflow → Annotated Video: writes frames (evidence: `code/curved_lane_detection.py`)
