Skip to content

Vojtech1025/car_parking_slot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Car Parking Slot Detection

A computer vision application for detecting available parking slots using YOLOv8 and ROI (Region of Interest) analysis.

Features

  • Car Detection: Uses YOLOv8 model to detect vehicles in video streams
  • ROI Management: Define regions of interest for parking areas
  • Multiple Input Sources: Support for video files and RealSense cameras
  • CLI Interface: Easy-to-use command-line interface

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd car_parking_slot
  2. Install dependencies (using uv):

    uv sync

    Or using pip:

    pip install -r requirements.txt

Usage

The application provides two main commands: set-roi for configuring regions of interest and detect for running car detection.

Setting ROI (Region of Interest)

Before running detection, you need to define the parking areas (ROI) in your video source.

python main.py set-roi --source <video_source> --output <roi_file>

Parameters:

  • --source: Path to video file or 'realsense' for RealSense camera
  • --output: Output file to save ROI configuration (default: roi.json)

Examples:

# Set ROI from a video file
uv run main.py set-roi --source resources/parking_lot.mp4 --output my_roi.json

# Set ROI from RealSense camera
uv run main.py set-roi --source realsense --output camera_roi.json

ROI Setup Process:

  1. The video will open in a window
  2. Click and drag to draw rectangles around parking areas
  3. Press 'q' to quit and save the ROI configuration
  4. The ROI data will be saved to the specified output file

Running Car Detection

Once you have configured the ROI, you can run car detection:

uv run main.py detect --source <video_source> --roi-config <roi_file>

Parameters:

  • --source: Path to video file or 'realsense' for RealSense camera
  • --roi-config: ROI configuration file (default: roi.json)

Examples:

# Run detection with default ROI file
uv run main.py detect --source resources/parking_lot.mp4

# Run detection with custom ROI file
uv run main.py detect --source resources/parking_lot.mp4 --roi-config my_roi.json

# Run detection with RealSense camera
uv run main.py detect --source realsense --roi-config camera_roi.json

Requirements

  • Python 3.8+
  • OpenCV
  • YOLOv8
  • Typer (for CLI)
  • RealSense SDK (optional, for RealSense camera support)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages