gpt4 book ai didi

c++ - 检测 parking 场线和ROI openCV

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:31:13 25 4
gpt4 key购买 nike

我正在做一个 openCV 项目,试图检测 parking 位并从图像中提取 ROI(感兴趣区域)以进行进一步的车辆检测。提供的图像将包含所有空 parking 位。我已经阅读了几篇关于此的文章和教程。到目前为止,我尝试过的方法是:

1.Convert image to grayscale using `cvtColor()`
2.Blur the image using `blur()`
3.Threshold the image to get edges `threshold()`
4.Find image contours using findContours()
5.Finding all convex contours using `convexHull()`
6.Approx polygonal regions using `approxPolyDP()`
7.Get the points for the result from 5, if total number of points =4.
Check for area and angle.

我想这种方法的问题是当我执行 findContours() 时,它会发现不规则和较长的轮廓,这导致 approxPolyDP 假设四边形大于 parking 位本身.一些 parking 线有洞/不规则。

我也尝试过 goodFeaturesToTrack() 并且它非常有效地给出角点,但是输出中存储的点是任意顺序的,我认为提取四边形/矩形会非常严​​格从中。

我在这上面花了很多时间。有没有更好的方法呢?

This是我正在玩的图像。

最佳答案

尝试在阈值图像上使用扩张以使孔消失。

这里有一个很好的教程:opencv erode and dilate .

关于c++ - 检测 parking 场线和ROI openCV,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11713641/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com