A computer vision–based smart parking system that detects vehicle occupancy in predefined parking spots using YOLOv8.
Parking spots are manually defined as polygons, and the system determines whether each spot is empty or full in real time.
- 🎥 Real-time vehicle detection using YOLOv8
🅿️ Manual drawing of parking rows and spots- 📐 Polygon-based occupancy detection
- 🟥 Automatic color change (green = empty, red = full)
- 🗂 Semi-transparent layout modal view
- ⚡ Optimized inference (YOLO runs periodically with cached detections)
- 🔗 Supports custom YouTube stream URL via command-line argument
- Python
- OpenCV
- YOLOv8 (Ultralytics)
- NumPy
- FFmpeg (for stream decoding)
Clone the repository:
git clone https://github.com/PublicStaticOussama/ParkSense.git
cd ParkSenseInstall dependencies:
pip install -r requirements.txtMake sure:
yolov8n.ptis placed in the project root directoryffmpegis installed and available in your system PATH
python main.pypython main.py --url "https://www.youtube.com/watch?v=VIDEO_ID"If no URL is provided, the system automatically falls back to the default stream defined in main.py.
- The admin defines parking rows and spots manually using polygon drawing.
- YOLO detects vehicles in the video stream.
- Detection runs every N frames for efficiency.
- Cached bounding boxes are reused between inference cycles.
- Each parking polygon is evaluated against detected vehicles.
- Spots are marked:
- 🟢 Green → Empty
- 🔴 Red → Occupied
A layout modal allows visualization of rows and spots in sorted order.
This project explores the feasibility of a scalable, camera-based smart parking system capable of monitoring street parking and integrating with map-based applications.