In the deployment of Smart Parking Information Systems, one of the biggest challenges is that surveillance cameras are rarely mounted perfectly perpendicular to the ground. Most video streams suffer from perspective distortion.
This engineering note dives into how we solve the parking space counting and localization problem by combining a high-speed object detection model with geometric transformations.
1. The Limitation of Standard Bounding Boxes
When using YOLOv11 to detect cars, the output consists of 2D bounding boxes. However, the (x, y) coordinates of a bounding box on a 2D camera frame do not accurately reflect the physical location of the car on the actual parking lot surface.
2. Applying the Homography Matrix
To "flatten" the perspective, we use a Homography matrix. By selecting a minimum of 4 fixed reference points on the camera frame and mapping them to 4 corresponding points on a 2D parking lot map, we can calculate the transformation matrix.
Whenever YOLOv11 returns the coordinates for the center point of the bottom edge of a bounding box (which roughly corresponds to the tire's contact point with the ground), this coordinate is multiplied by the Homography matrix to calculate the precise physical location (in satellite coordinates or local XY coordinates) on the digital parking map.
3. Engineering Trade-offs
Computing an additional matrix transformation for every object on every frame can increase the computational load on Edge devices. To optimize performance, we implemented a mechanism that only recalculates the Homography mapping when a bounding box moves beyond a specific threshold, saving significant CPU cycles.


