A complete local application for uploading road videos, detecting lane boundaries, saving annotated videos, and downloading lane-analysis reports.
- Simple responsive upload dashboard
- Drag-and-drop video upload
- MP4, AVI, MOV, MKV, WebM and M4V support
- CPU-based OpenCV lane detection; no GPU required
- Green lane overlay and detected lane-center line
- Vehicle offset estimation
- Centered, left-drift and right-drift status
- Processing progress and persistent job history
- Saved annotated video output
- Downloadable JSON analysis report
- SQLite metadata storage
- FastAPI Swagger documentation
- Optional FFmpeg H.264 optimization when FFmpeg is installed
lane-detection-studio/
├── backend/
│ ├── app/
│ │ ├── services/lane_detector.py
│ │ ├── services/video_processor.py
│ │ ├── config.py
│ │ ├── database.py
│ │ ├── main.py
│ │ ├── models.py
│ │ └── schemas.py
│ ├── tests/
│ └── requirements.txt
├── frontend/
│ ├── index.html
│ ├── app.js
│ └── styles.css
├── storage/
│ ├── input/
│ ├── output/
│ └── reports/
├── Dockerfile
├── docker-compose.yml
├── run_linux.sh
└── run_windows.bat
cd lane-detection-studiopy -m venv .venv
.\.venv\Scripts\Activate.ps1When PowerShell blocks activation, run this once in the same terminal:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy BypassThen activate again.
python -m pip install --upgrade pip
pip install -r backend\requirements.txtuvicorn app.main:app --app-dir backend --reload --host 0.0.0.0 --port 8000Open:
- Application:
http://localhost:8000 - Swagger API:
http://localhost:8000/docs
You can also double-click run_windows.bat after Python is installed.
cd lane-detection-studio
chmod +x run_linux.sh
./run_linux.shOpen http://localhost:8000.
docker compose up --buildOpen http://localhost:8000.
- Upload a front-facing road video.
- The API saves the original video under
storage/input. - OpenCV processes each frame using edge detection, a road region of interest, Hough line detection and temporal smoothing.
- The system writes an annotated output under
storage/output. - A JSON report is saved under
storage/reports. - The web dashboard stores and displays processing history through SQLite.
The report includes:
- Frames processed
- Video FPS and duration
- Lane-detection rate
- Average confidence
- Average vehicle offset
- Maximum absolute offset
- Lane-departure event count
- A one-second sampled status timeline
This CPU pipeline works best when:
- The camera faces forward and remains stable.
- Lane markings are visible.
- The road is reasonably illuminated.
- The vehicle is travelling on a mostly straight or moderately curved road.
Performance can decrease during heavy rain, night driving, sharp turns, worn lane markings, shadows, construction zones and camera vibration. This project is intended for learning, prototyping and research; it is not a certified advanced driver-assistance system.
| Method | Route | Purpose |
|---|---|---|
GET |
/api/health |
API health check |
POST |
/api/videos/upload |
Upload and queue a video |
GET |
/api/jobs |
List saved jobs |
GET |
/api/jobs/{job_id} |
Read one job |
GET |
/api/jobs/{job_id}/report |
Download JSON report |
DELETE |
/api/jobs/{job_id} |
Delete a job and files |
cd backend
python -m pytest -qThe LaneDetector service can be replaced by a deep-learning model such as a segmentation network while keeping the same upload, storage, API and dashboard layers. For long videos or multiple simultaneous users, move processing from FastAPI background tasks to Celery or RQ with Redis.