一种检测图像中线条的好方法? [英] A good approach for detecting lines in an image?

查看:493
本文介绍了一种检测图像中线条的好方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一些代码,这些代码使用OpenCV库检测草绘的白线.我需要别人对我使用的方法的意见(因为我敢肯定有比我更好的方法).另外,我得到的结果也不如我预期的好,因为图像中的细微变化需要调整参数(并且我需要对固定参数进行操作).

I've written some code that uses OpenCV libraries to detect white lines painted on grass. I need someone's opinion on the approach I used (as I'm sure there's a much better way than mine). Also, the results I'm getting are not as good as I expected because slight variations in the image require tweaking the parameters (and I need to operate on fixed parameters).

到目前为止我的方法:

  1. 从网络摄像头抓取图像(并明显变成灰度)
  2. 通过阈值过滤器运行它(使用THRESH_TO_ZERO模式,将阈值以下的所有像素清零).
  3. 模糊图像
  4. 通过侵蚀过滤器运行
  5. 通过Canny边缘检测器运行
  6. 最后,获取此经过处理的图像并使用概率霍夫变换HoughLinesP查找线段

我应该更改过滤器的顺序吗?

Should I change the sequence of the filters?

P.S.我不太担心处理能力;我在GPU B-)上运行HoughLinesP

P.S. I'm not too concerned about processing power; I'm running the HoughLinesP on the GPU B-)

此外,这是一个示例图像:

Also, here is a sample image:

我得到的结果是: 与康妮 不使用Canny(参数略有调整)

The results I'm getting: with canny WITHOUT canny (slightly tweaked parameters)

任何帮助或指导将不胜感激!我只是不知道该怎么做才能改善它!

Any help or guidance would be appreciated! I just have no idea what to do to improve it!

更新 根据选择的答案使用了非常快速的骨架实现(带有模糊的TONS)之后,我得到了:

UPDATE After using a really quick skeleton implementation (with TONS of blur) as per the chosen answer, I got this:

推荐答案

我会尝试使用图像的骨架表示.精明的问题在于,由于线条的宽度,它基本上会导致两条线条.

I would try to use a skeleton representation of the image. The problem with your canny, here, is that it basically results in two lines because of the width of the line.

然后我将对其进行霍夫变换.

Then I would apply the Hough transform on it.

这篇关于一种检测图像中线条的好方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆