GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Squidly1408/Red_car_counter

BranchesTags
Open more actions menu

Latest commit

 

History

2 Commits
2 Commits

Folders and files

NameName
Last commit message
Last commit date
README.md
README.md
 
 
red_car_live.py
red_car_live.py
 
 
urls.txt
urls.txt
 
 
yolov8n.pt
yolov8n.pt
 
 

Repository files navigation

Logo

Red Car Counter (Live Webcam Mosaic)

This project loads still images from traffic webcam URLs, combines them into a mosaic, runs YOLO object detection, and counts vehicles that appear red based on HSV color filtering inside each detected bounding box.

The app opens a live OpenCV window and updates every few seconds.

Files

  • red_car_live.py - Main script
  • urls.txt - Webcam image URLs (one per line)
  • yolov8n.pt - YOLO model weights

Requirements

  • Python 3.9+
  • pip
  • Internet access (for webcam URLs)

Python packages:

  • ultralytics
  • opencv-python
  • numpy
  • requests

Install packages:

pip install ultralytics opencv-python numpy requests

Quick Start

From this folder, run:

python red_car_live.py

Then press ESC in the OpenCV window to quit.

URL File Format

urls.txt should contain one image URL per line. Empty lines and lines starting with # are ignored.

Example:

https://example.com/cam1.jpg
https://example.com/cam2.jpg
# https://example.com/disabled.jpg

Common Usage Examples

Default run:

python red_car_live.py

Faster refresh and larger model:

python red_car_live.py --refresh 2 --model yolov8s.pt

Count multiple vehicle classes:

python red_car_live.py --vehicles car,truck,bus,motorcycle

Custom tile size and fixed columns:

python red_car_live.py --tile-size 640x360 --cols 3

Tune red sensitivity:

python red_car_live.py --min-red-ratio 0.12

CLI Options

  • --urls-file (default: urls.txt)
    Text file with one URL per line.
  • --model (default: yolov8n.pt)
    YOLO weights file (for example yolov8n.pt, yolov8s.pt).
  • --refresh (default: 5.0)
    Seconds between refresh cycles.
  • --tile-size (default: 960x540)
    Mosaic tile size as WIDTHxHEIGHT.
  • --cols (default: 0)
    Number of mosaic columns (0 = auto).
  • --conf (default: 0.35)
    YOLO confidence threshold.
  • --iou (default: 0.45)
    YOLO IoU threshold.
  • --min-red-ratio (default: 0.08)
    Minimum red-pixel ratio in a detected vehicle box to classify it as red.
  • --vehicles (default: car)
    Comma-separated YOLO class names to treat as vehicles.
  • --per-cycle-unique
    Enable simple near-duplicate suppression per cycle.

Notes

  • The script counts detections per refresh cycle and keeps a running total.
  • Red classification is HSV-based and may need tuning depending on lighting/weather.
  • If a webcam URL fails or returns non-image content, it is skipped for that cycle.

Troubleshooting

  • If python is not found, use your full Python path or launcher (py).
  • If model loading fails, confirm yolov8n.pt exists in this folder or pass --model with a valid path.
  • If nothing appears, verify URLs in urls.txt return valid images in a browser.

About

No description, website, or topics provided.

Resources

Readme
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.