Using OpenCV to detect parking spots

前端 未结 1 696
暖寄归人
暖寄归人 2021-02-02 03:12

I am trying to use opencv to automatically find and locate all parking spots in an empty parking lot.

Currently, I have a code that thresholds the image, applies canny e

相关标签:
1条回答
  • 2021-02-02 03:39

    Consider thinning your binary image, and then detect the end points and the branch points. Here is one such result based on the images provided; end points are in red and branch points are in blue.

    enter image description here

    Now you can find the locations of the parking spaces. A pair of blue dots is always connected by a single edge. Each blue dot is connected to either two or three red points. Then there are several ways to find the parking space formed by two blue dots and two red dots, the simplest is along the lines: find the closest pair of red dots where one dot is connected to a certain blue dot, and the other red point is connected to the other blue dot. This step can also be complemented by checking how close to parallel lines are the edges considered.

    0 讨论(0)
提交回复
热议问题