如何识别图像中的真实正方形

发布于 2024-09-17 19:07:07 字数 405 浏览 2 评论 0原文

我正在使用 OpenCV 进行图像中的正方形检测。 squares.c 示例确实很有帮助,但我的问题是它几乎可以识别所有有 4 个接近 90 度角的东西。

然而,我的目标是仅识别视频源中图像中的真实方块。这意味着物体本身有 4 条长度相同的边和 4 个 90 度角。乍一看这听起来相当简单,但由于图像中的对象可能会倾斜,因此角度可能在 45 度到 135 度之间变化,并且边缘具有不同的长度。如果我检查这些属性,尽管我仍然识别出不是正方形的矩形。

几天来我一直在思考一个好的解决方案,只识别真正的方块,但我想出的一切仍然有缺陷。我想知道大家是否知道角的角度和边长之间的确切关系是什么。到目前为止,根据我的猜测,我已经走了很远,但有时会弹出我不想识别的随机方块。我确实认为存在一些数学关系,但我无法真正找到透视图中正方形的公式。

任何帮助将不胜感激!

I am using OpenCV for square detection in an image. The squares.c example is a really great help, but my problem is that it recognizes pretty much everything that has 4 corners that are close to 90 degrees.

My goal is it however to only recognize the real squares in an image from a video feed. This means the objects themselves have 4 edges with the same length and 4, 90 degree angles. This sounds rather easy at first, but since an object might be tilted in the image, the angles can vary between something like 45 and 135 degrees and the edges have a different length. If I check these attributes though I am still recognizing rectangles that are no squares.

I've been thinking for a good solution to only recognize real squares for a few days now, but everything I come up with is still flawed. I wonder if any of you knows what the exact relation between the angles of the corners and the edge length is. With my guessing so far I have come pretty far, but sometimes random squares pop up that I don't want to recognize. I really think there is some mathematical relation, but I can't really find a formula for squares in a perspective view.

Any help would really be appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

忘你却要生生世世 2024-09-24 19:07:07

没有任何参考坐标系,这怎么可能呢?如果您基于视频源进行识别,是否可以通过始终将正方形保持在视野中来“教导”正方形的外观?也许你可以用它来计算出 3 个空间中的旋转,然后你必须将其应用于提要中的其他所有内容。

Without any reference coordinate system, how is this even possible? If you are doing the recognition based on a video feed, can your be "taught" what a square looks like by keeping a square in the field of view at all times? Maybe then you can use this to figure out what the rotations are in 3 space, which you'd then have to apply to everything else in the feed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文