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

标签 c++ image-processing opencv edge-detection roi

我正在做一个 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/

相关文章:

Android SREC_JNI编译错误

c++ - VBO 照明和索引

c++ - C/C++ 中的无限循环

visual-studio-2010 - OpenCV 2.1 : facedetect. cpp 发现丑脸时崩溃

opencv - 使用 OpenCV 分割图像

python - OpenCV:着色失败

python - 为什么我不能调整 PNG 文件的亮度级别

java - 断言失败。 convertPointsFromHomogenous

c++ - 如何使用 SVM 从视频中检测对象

C++11:istream.get() 在 EOM 上停止