TrafficLab-3D: Open Source Digital Twin Traffic Visualization from CCTV Footage

By Prahlad Menon 4 min read

Traffic engineers and researchers have long relied on expensive sensor arrays and proprietary software to analyze vehicle movements at intersections. TrafficLab-3D changes that equation entirely — it’s an open-source Python tool that transforms ordinary CCTV footage into synchronized 3D digital twin visualizations, complete with satellite floor views from Google Maps.

What Is TrafficLab-3D?

TrafficLab-3D is a desktop application that takes two inputs — an mp4 video from any CCTV camera and a Google Maps location — and produces a real-time 3D traffic visualization. Vehicles detected in the footage are projected onto a satellite view with accurate 3D bounding boxes, speed estimates, and orientation tracking.

The result is a digital twin of the intersection that anyone can create without specialized hardware or commercial licenses.

Key Features

Camera Calibration (CCTV-to-Satellite Projection)

The calibration module lets you map points from the CCTV perspective to corresponding locations on the satellite image. This homography-based projection handles the geometric transformation between the camera’s oblique angle and the top-down satellite view. You pick correspondence points manually, and the system computes the projection matrix.

YOLO Inference with Swappable Models

TrafficLab-3D uses YOLO for vehicle detection and supports swapping between model versions (YOLOv8, YOLOv9, YOLOv11) and different tracker implementations (BoT-SORT, ByteTrack). This modularity means you can trade off speed versus accuracy depending on your hardware and use case.

3D Bounding Box Visualization

Detected vehicles aren’t just dots on a map — they’re rendered as 3D bounding boxes on both the original video feed and the satellite floor view simultaneously. The dual-view display shows the CCTV footage alongside the projected satellite view in real time.

Speed and Orientation Tracking

By tracking vehicles across frames and knowing the real-world scale from calibration, the system estimates vehicle speeds and heading directions. This data can feed into traffic flow analysis, conflict detection, or capacity studies.

Who Is This For?

TrafficLab-3D is explicitly designed for accessibility:

  • University students working on traffic engineering projects without lab budgets
  • Traffic investigators who need quick intersection analysis from existing camera footage
  • Researchers prototyping digital twin concepts before investing in commercial platforms
  • City planners wanting to visualize traffic patterns from already-deployed CCTV infrastructure

All you need is a video file and a Google Maps screenshot of the location.

How It Works

  1. Load your CCTV video (mp4 format from any camera angle)
  2. Set the satellite reference by providing the Google Maps location
  3. Calibrate by marking corresponding points between camera view and satellite view
  4. Run inference — YOLO detects and tracks vehicles frame by frame
  5. Visualize — watch the synchronized 3D digital twin update in real time

The entire pipeline runs locally on your machine. No cloud dependencies, no API keys, no subscriptions.

Technical Stack

  • Python with OpenCV for video processing
  • Ultralytics YOLO for object detection
  • NumPy for homography computation
  • Tkinter-based GUI for the desktop application
  • Support for multiple tracker algorithms

Getting Started

git clone https://github.com/duy-phamduc68/TrafficLab-3D.git
cd TrafficLab-3D
pip install -r requirements.txt
python main.py

The repository includes sample data and documentation for the calibration workflow.

Why This Matters

Commercial traffic analysis platforms cost tens of thousands of dollars annually. Meanwhile, cities worldwide have thousands of CCTV cameras already recording intersection footage that goes largely unanalyzed. TrafficLab-3D bridges that gap — turning passive surveillance footage into active traffic intelligence with zero cost.

The digital twin approach also makes results intuitive for non-technical stakeholders. A city council member can understand a 3D satellite visualization far more easily than a spreadsheet of vehicle counts.

FAQ

Can TrafficLab-3D work with any CCTV camera?

Yes, it accepts any mp4 video file regardless of camera brand or resolution. Higher resolution and frame rates will produce better tracking results, but the system works with standard surveillance footage.

Does it require a GPU?

YOLO inference benefits significantly from a CUDA-capable GPU, but the system can run on CPU — just slower. For real-time visualization, a mid-range GPU (RTX 3060 or equivalent) is recommended.

How accurate is the speed estimation?

Accuracy depends on calibration quality. With good correspondence points and a known scale reference, speed estimates are typically within 5-10% of ground truth. More calibration points improve accuracy.

Can I use this for research publications?

Absolutely. The project is open source and designed for academic use. Check the repository license for citation requirements.

Does it handle pedestrians and cyclists?

The YOLO models detect multiple object classes including pedestrians and cyclists. The 3D bounding box visualization adapts to different object sizes automatically.