This application provides accurate parking spot detection using a combination of computer vision and machine learning. The system requires:
- An image of a parking lot
- A corresponding mask image where parking spots are marked in white
The system then identifies available and occupied parking spots, displaying the results visually.
- Accurate detection using custom mask images
- Web interface for easy uploading and processing
- Real-time results showing available spots
- Simple mask creation process
- Python 3.8+
- OpenCV
- scikit-image
- Flask
- scikit-learn
-
Clone the repository:
git clone https://github.com/4444Harsh/Parking_lot_Area.git cd parking-system -
Create and activate a virtual environment:
python -m venv .venv source .venv/bin/activate # Linux/Mac .venv\Scripts\activate # Windows
-
Install dependencies:
pip install -r requirements.txt
Create mask images for your parking lots:
- Open the parking lot image in an image editor
- Paint all parking spots pure white (RGB 255,255,255)
- Paint all non-parking areas black (RGB 0,0,0)
- Save as PNG file
Example:
| Parking Lot | Mask Image |
|---|---|
![]() |
![]() |
python app.pyAccess the web interface at: http://localhost:5000
- Upload a parking lot image
- Upload its corresponding mask image
- Click "Process Images"
- View the results showing available (green) and occupied (red) spots
parking-system/
├── static/
│ ├── masks/ # Predefined mask images
│ ├── uploads/ # User uploaded images
│ └── results/ # Processed results
├── templates/
│ └── index.html # Frontend
├── parking_detector.py # Detection logic
├── app.py # Flask backend
├── model.p # Pretrained model
└── README.md
-
Error processing images: Ensure your mask image has:
- Pure white (255,255,255) parking spots
- Pure black (0,0,0) non-parking areas
- Same dimensions as the parking lot image
-
Model not loading: Verify
model.pexists in the root directory
Sample images are provided in:
static/uploads/parking_image_test.png- Example parking lotstatic/masks/mask_1920_1080.png- Corresponding mask
For questions or support, please contact [[email protected]].


