This project demonstrates a simple car parking space detection system using OpenCV and cvzone. It allows you to mark parking spaces on a static image, and then it detects the occupancy of these spaces in a video feed.
The main goal of this project is to detect and monitor car parking spaces. It consists of two main parts:
-
parkingspacepicker.py: This Python script allows you to manually select parking space coordinates on a static image (
carParkImg.png). You can left-click to mark parking spaces and right-click to remove them. The coordinates are saved in a file namedCarParkPosusing pickle. -
main.py: This Python script reads the saved parking space coordinates and processes a video feed (
carPark.mp4) to detect the occupancy of parking spaces. It displays the video with marked parking spaces and updates the count of free spaces in real-time.
-
Clone this repository to your local machine:
git clone [https://github.com/harshbafnaa/car-parking-detection.git](https://github.com/thinkrobotics/Live-Smart-Parking-Detection-System.git)
-
Install the required dependencies, including OpenCV and cvzone:
pip install opencv-python-headless pip install numpy pip install cvzone
-
Ensure you have the following files in your project folder:
carPark.mp4(video file)carParkImg.png(static image of the parking lot)parkingspacepicker.pymain.py
-
Run
parkingspacepicker.pyto mark the parking spaces on the static image. Left-click to add parking spaces and right-click to remove them. The coordinates will be saved inCarParkPos. -
Run
main.pyto start processing the video feed and detecting parking space occupancy. The video will display with marked parking spaces and a count of free spaces.
carPark.mp4: Input video file containing the parking lot footage.carParkImg.png: Static image of the parking lot for marking parking spaces.parkingspacepicker.py: Script to select and save parking space coordinates.main.py: Script for processing the video and detecting parking space occupancy.CarParkPos: Binary file containing saved parking space coordinates (created byparkingspacepicker.py).
Contributions to this project are welcome! If you have any ideas, improvements, or bug fixes, please create a pull request. Feel free to open issues for discussions or feature requests.
This project is licensed under the MIT License.
- This project was created by [Dhruv Khatter]