OpenCV标识线和曲线 [英] OpenCV Identifying Lines and Curves

查看:635
本文介绍了OpenCV标识线和曲线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始学习OpenCV编程。我可以问一下如何在OpenCV中识别线和曲线?我的问题是,我必须确定图像是否包含凸或凹(水平或垂直曲线)曲线,垂直,对角线或水平线。

I'm just starting to learn OpenCV programming. May I just ask about how can I identify lines and curves in OpenCV? My problem is that I have to identify if the image contains a convex or concave (horizontal or vertical curve) curve, a vertical, diagonal or a horizontal line.

在我的代码,我使用 CvSetImageROI 采取图像的特定部分,然后我试图根据所述的线/曲线识别每个。

In my code, I used CvSetImageROI to take a particular part of an image, and then I'm trying to identify each according to the said lines/curves.

OpenCV中是否有可用的功能?非常感谢您的帮助。顺便说一句,我使用Linux和C ++。

Are there functions in OpenCV that are available? Thank you very much for the help. By the way, i'm using Linux and C++.

推荐答案

Hough transform http://en.wikipedia.org/wiki/Hough_transform http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm
是标准的做法它。在它的简单形式(如在OpenCV中实现的)中,它可以检测任意的位置和角度以及线段的线。

Hough transform http://en.wikipedia.org/wiki/Hough_transform, http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm is the standard way to do it. In its simple form (as implemented in OpenCV) it can detect lines of arbitray position and angle and line segments.

查看示例
http://opencv.itseez.com/modules/imgproc/doc/feature_detection.html?highlight=hough#houghlinesp

对于曲线,检测过程有点复杂,您需要一般的Hough变换它在OCV中还不可用,但您可以将其写为练习或查找良好的实现。
http://en.wikipedia.org/wiki/Generalised_Hough_transform 说明(在短)

For curves, the detection process is a bit more complicated, and you need the general Hough transform It is not yet available in OCV, but you can write it as an exercise or look for a good implementation. http://en.wikipedia.org/wiki/Generalised_Hough_transform describes it (in short)

这篇关于OpenCV标识线和曲线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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