This project detects and counts vacant car parking spaces in a video feed using OpenCV image processing (adaptive thresholding and pixel counting) — no machine learning model is required.
ParkingSpacePicker.pylets you mark parking space positions on a reference image (carParkImg.png). Left-click to add a space, right-click to remove one. Positions are saved to theCarParkPosfile. Pressqto quit.main.pyreadscarPark.mp4, applies grayscale conversion, Gaussian blur, adaptive thresholding, and median blur to each frame, then counts non-zero pixels within each saved parking space region to decide whether it's occupied or free. Pressqto quit.
- Clone the repository to your local machine.
- Install the necessary dependencies:
pip install -r requirements.txt - (Optional) Re-mark parking spaces for your own footage:
python ParkingSpacePicker.py - Run the detector:
python main.py - The system displays each parking space as green (free) or red (occupied), along with a running count of available spots.
main.py— runs the parking space detector oncarPark.mp4.ParkingSpacePicker.py— interactive tool for marking parking space positions.CarParkPos— pickled list of parking space coordinates.carParkImg.png— reference image used by the picker tool.carPark.mp4— sample video feed used by the detector.
Contributions to the project are welcome. Please submit a pull request with your changes.