如何测量图像中的距离?

发布于 2024-09-02 20:36:35 字数 496 浏览 10 评论 0原文

假设我们有一个像这样的图像

替代文字
(来源:curiousexpeditions.org )

假设我们已经在这张图片中使用了过滤器和边缘检测算法。现在我的目标是测量距离(不是实际距离,距离可以是任何任意单位)。 例如:如何求出大厅的长度? (直到窗户)

或者书架的高度?你到底如何放置“秤”并进行测量。我正在寻找想法。然而,如果答案是 OpenCV 的话,那将会有所帮助。

Let's say we have an image like so

alt text
(source: curiousexpeditions.org)

Let's say we've already used filters and an edge detection algorithm in this pic. Now my goal is to measure distances (NOT actual distances, distance can be in any arbitrary unit) .
eg: How do I find the length of the hall? (until the window)

Or the height of the bookshelves? How exactly do you place the "scale" and measure. I'm looking for ideas. However it would help if the answers were in terms of OpenCV.

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

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

发布评论

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

评论(2

起风了 2024-09-09 20:36:35

这取决于您想要做什么。

您提到您想测量书架的高度。如果您可以认为书架的近距离区域比该行末尾的书架末端的高度“短”,那么您所需要的只是测量距离。选择“像素”单位,然后使用毕达哥拉斯定理测量距离。 (x^2+y^2 = z^2)

您可能真正想要的是让近处书柜的高度与远处书柜的高度相同。在这种情况下,您必须获得更多信息。你必须做一个 2D -> 3D 转换:您有一个 2D 图像,您需要从该图像重建 3D 图片。此时,您需要第三条信息,因为您需要 2 个变量中的 3 个变量(X、y、z)。

如果您正确校准系统并有第二个参考点(例如激光线),您绝对可以使用 OpenCV 来做到这一点。这称为结构光方法 - 请参阅此链接了解更多信息或谷歌“机器视觉结构光”

It depends on what you're trying to do.

You mention you want to measure the height of the bookshelves. If its OK with you to consider the close area of the bookshelf "shorter" than the height of the end of the bookshelf at the end of the row, all you're looking for is to measure distance. Choose a unit of "pixels" and then measure the distance using the Pythagorean theorem. (x^2+y^2 = z^2)

What you're probably really looking for is to have the height of the near bookcase be the same as the height of the far bookcase. In that case, you have to have more information. You have to do a 2D -> 3D transformation: You have a 2D image and you need to reconstruct a 3D picture from that image. At that point, you need a 3rd piece of information, since you want 3 variables (X, y, z) from 2 variables.

You can definitely do this with OpenCV if you properly calibrate the system and have a second reference point (for example, a laser line). This is known as a structured light approach - see this link for more information or google "machine vision structured light"

如梦 2024-09-09 20:36:35

由于您可以假设书架与其下面的书架平行,因此书架之间的实际距离在任何一点都是相等的。您可以确定,在深度 X 像素之后,感知高度会降低 Y %。您应该能够快速建立清晰的模式。实际空间中的所有平行线和直角将使数学变得容易。

在每个书架的开头和结尾绘制一些起点。您可以在这里找到相关的数学主题:

http://en.wikipedia.org/wiki/Slope

http://en.wikipedia.org/wiki/Cartesian_cooperative_system

Since you can assume that a bookshelf is parallel to the one below it, then the actual distance between bookshelves is equal at any point. You can determine that after X pixels of depth, the perceived height decreases by Y %. You should be able to establish a clear pattern quickly. All of the parallel lines and right angles in your actual space will make the math easy.

Plot some starting points at the beginning and end of each bookshelf. You can find the relevant math topics here:

http://en.wikipedia.org/wiki/Slope

http://en.wikipedia.org/wiki/Cartesian_coordinate_system

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