πŸ€– LateAI
Home β€Ί Tutorials β€Ί Parking Space Counter
πŸ…ΏοΈ

Parking Space Counter

Intermediate Β· 1 day
πŸ“Ά Intermediate ⏱ 1 day πŸ’° Free (software only) 🏷 CV Zone

πŸ“Œ Overview

Analyse a car park's surveillance video in real time: pre-mark each parking bay, check frame by frame whether a car occupies it, and report the number of free spaces with colour-coded overlays.

The core idea is the classic 'mark the regions first, then decide occupancy': store each bay's coordinates and judge occupancy from pixel statistics (whether a large area of car pixels sits inside) or a small model.

🧰 What you need

πŸ”§ Step by step

1

Get your source material

Prepare a car park surveillance video

Find a frame with no cars in it to use for marking the bays

2

Mark the parking bays

Draw each bay as a polygon on the empty frame

Save every bay's vertex coordinates to a list or file

3

Read frames and judge occupancy

Read the video frame by frame

Count the 'car-like' pixels inside each bay region

4

Set the occupancy threshold

The pixel counts differ clearly between an empty and an occupied bay

Put the threshold in the middle to reduce misjudgements

5

Visualise the output

Draw free bays in green and occupied ones in red

Show the free-space count at the top of the frame

6

Refine and extend

Smooth the threshold over several frames to stop it flickering

You can also track how long each bay stays occupied for parking management

πŸ’‘ Tips

View original β†— ← Back to LateAI home