用透视投影进行矩形识别的Hough变换与Contour检测 [英] Hough transformation vs Contour detection for Rectangle recognition with perspective projection

查看:257
本文介绍了用透视投影进行矩形识别的Hough变换与Contour检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用轮廓检测​​进行矩形检测,并在调整透视投影之前使用OpenCv应用多边形以获取矩形的位置。而且效果很好。但是我小组中的一些人建议改造霍夫。我想知道使用Hough变换进行矩形检测是否有任何优势。

I made rectangle detection work with contour detection and apply polygon with OpenCv to get location of the rectangle before adjusting the perspective projection. And it's working great. But some people in my group suggested Hough transformation instead. I wonder if there is any advantage of using Hough transformation for rectangle detection.

更新:我尝试了这两种方法。在我的例子中,两种方法在Canny边缘检测后都能正常工作。但是,由于Hough变换产生线,我们必须假设几行,例如线的长度和线的可连接性,并且应该进行额外的计算,例如搜索连接线并从连接线中找到角点。就个人而言,我更喜欢轮廓法,因为它的概念更简单。使用该方法,您只需搜索可以使用具有4个角的闭合和凸多边形近似的轮廓,并调整多边形的透视投影。就是这样。

Update: I tried both of the methods. In my example, both methods worked fine after Canny edge detection. But since Hough transformation produces lines, we have to assume several things such as length of lines and connectability of the lines and should do additional computations such as searching connected lines and find corner points from the connected lines. Personally, I liked contour method better since its concept is simpler. With the method, you just search contours that can be approximated with closed and convex polygons with 4 corners and adjust the polygons for their perspective projections. That's about it.

推荐答案

到目前为止,您在轮廓检测方面取得了哪些成果?有什么例子吗?

What sort of results are you getting with contour detection so far? Got any examples?

Hough变换应该适用于矩形检测IFF你可以假设矩形的边是图像中最突出的线。
那么你可以简单地检测霍夫空间中的4个最大峰值,你得到了你的矩形。

Hough transform should work well for rectangle detection IFF you can assume that the sides of the rectangle are the most prominent lines in your image. Then you can simply detect the 4 biggest peaks in hough space and you got your rectangle.

这可以用例如一张白纸的照片在黑暗的背景前。

This works for example with a photo of a white sheet of paper in front of a dark background.

理想情况下,您可以使用模糊,阈值,形态运算符预处理图像,以便在进行霍夫变换之前删除任何小规模结构。

Ideally you would preprocess the image with blur, threshold, morphological operators to remove any small-scale structures before hough transform.

如果图像中有多个较小的矩形或其他种类的突出线,轮廓检测可能是更好的选择。

If there are multiple smaller rectangles or other sorts of prominent lines in your images, contour detection might be the better choice.

霍夫变换的一些一般优点脱离我的脑海:

Some general advantages for the hough transform off the top of my head:


  • 如果矩形的一部分被阻挡或超出框架,霍夫变换仍然可以工作。

  • Hough变换应该比轮廓检测更快,我猜?

  • Hough变换会忽略任何不是直线的东西,所以你可能有杂乱的图像获得了更大的成功。 (如果矩形边是最突出的线)

最后它可能取决于输入数据。有什么例子吗?

In the end it probably depends on the input data. Got any examples?

也许合并的方法最好?请参阅
结合霍夫变换和轮廓算法检测车辆牌照

Perhaps a combined approach would be best? see Combining Hough Transform and Contour Algorithm for detecting Vehicles License-Plates

我做了一些使用霍夫变换检测的实验一段时间后,您可以看到一些初步结果:
http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=14491&start=9

I did some experiments in using hough transform to detect rectangles a while back, you can see some preliminary results here: http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=14491&start=9

不幸的是,目前这一切都存在,该项目目前处于中断状态,最终我希望在我不太忙的时候恢复它。

Unfortunately that is all that exists at the moment, the project is currently on hiatus, eventually I hope to resume it when I am less busy.

我d对你的结果非常感兴趣。

I'd be very interested in your results in comparison.

(如果你正在进行透视校正,也可以查看透视变形矩形的比例

(If you are doing perspective correction, also check out proportions of a perspective-deformed rectangle )

这篇关于用透视投影进行矩形识别的Hough变换与Contour检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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