Identify all the available parking spaces with top view camera using Python.
Python3 & PIP Windows Installation
pip install -r requirements.txt
In order to run the script, you must first identify manually all parking spaces, including both ocupied and free ones.
To do so, execute the following command to run the parking space selection tool:
python ParkingSpacePicker.py
This tool will open a window showing in this case the resources/parking.png
image.
You should replace resources/parking.png
with an according top view image of your parking lot.
Once you have executed the selection tool, follow these instructions to mark/unmark parking spaces:
- Left click the left top corner of each parking space
- Right click inside an existing parking space to delete it
After marking parking spaces, you are ready to execute the script which will show if the parking spaces are available or occupied. To do so, run the following command:
python main.py
This will load the selected video/stream through the line 8: cv.VideoCapture('resources/topdownparking.mp4')
. Replace it with your live stream/parking lot video.
A window with all previously marked spaces will show up. If the parking space is free, the rectangle will be red, else, it will be colored green.
Adjust the space-occupation threshold by modifying the default 200
value from if count < 200:
in line 23.