是否可以用相机测量到物体的距离?

发布于 2024-10-10 08:02:03 字数 125 浏览 4 评论 0原文

可以用手机摄像头测量到物体的距离吗?

我的意思是,在我的应用程序中,我启动相机,将相机面对物体(比如说房子),然后按下按钮,它会计算距离并在屏幕上显示我。

如果可能的话我可以在哪里找到一些教程或相关信息?

Is it possible to measure distance to object with phone camera?

I mean, in my application I start the camera, facing the camera to the object (lets say house) and then press the button and it calculates the distance and shows me in screen.

If it's possible where I can find some tutorial or information about it?

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

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

发布评论

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

评论(10

欲拥i 2024-10-17 08:02:03

我承认这个问题已经得到了充分的回答(明显需要平地和可能的准确性问题),但对于那些不相信它可以完成或需要摄像机的人,让我解释一下低级数学需要这样做......

alt text

上面的图片显示我站在我的房子外面。水平 (d) 是我要测量的距离,垂直 (h) 是我握住相机时距地面的高度。在这种情况下,当我将 Android 相机保持在与眼睛齐平的位置(大约 67 英寸或 1.7 米)时,“h”是一个已知值。当我倾斜相机将其直接瞄准我的房子与地面接触的点时,软件所需要做的就是算出相对于垂直方向的角度 (a),并且可以使用以下公式计算“d”:

d = h * tan a

I accept the question has been answered adequately (with the obvious caveats of requiring level ground and possible accuracy problems) but for those who don't believe it can be done or that it needs a video camera, let me explain the low-level math needed to do it....

alt text

The picture above shows me standing outside my house. The horizontal (d) is the distance I want to measure and the vertical (h) is the height above the ground at which I'm holding the camera. In this case 'h' is a known value when I'm holding the android camera at eye-level (approx 67 inches or 1.7 metres). When I tilt the camera to aim it directly at the point my house meets the ground, all the software needs to do is work out the angle (a) relative to vertical and it can calculate 'd' using...

d = h * tan a
左岸枫 2024-10-17 08:02:03

那么您应该阅读 ithinkdiff.com 如何“测量”距离:

使用 iPhone 的角度来估计到地面上某个点的距离。
将 iPhone 放在您面前,对准相机中的点并获得直接
读取距离。然后可以在速度工具中使用该距离。

所以基本上它需要你拿着手机的高度(眼睛水平),然后你必须将相机指向物体接触地面的点。然后手机测量倾斜度,并通过简单的三角学计算距离。

这当然不是很准确。物体离得越远,它的精确度就越低。它还假设地面是水平的。

Well you should read how ithinkdiff.com "measures" the distance:

Uses the angle of the iPhone to estimate the distance to a point on the ground.
Hold the iPhone in front of you, align the point in the camera and get a direct
reading of the distance. The distance can then be used in the speed tool.

So basically it takes the height of where you hold the phone (eye-level), then you must point the camera to the point where object touches the ground. Then the phone measures the inclination and with simple trigonometry it calculates distance.

This is of course not very accurate. It gets less accurate the further the object is. Also it assumes that the ground is level.

关于从前 2024-10-17 08:02:03

没有。相机只能为您提供图像数据,而仅凭图像无法为您提供足够的信息来提供深度信息。如果您有多个具有位置信息的图像甚至视频,您可以对其进行处理以三角测量距离,但仅单个图像不足以为您提供距离。

Nope. The camera can only give you image data and an image alone doesn't give you enough information to give you depth information. If you had multiple images that you had location information for or even video you could then process it to triangulate the distance, but a single image alone would not be enough to give you a distance.

冷弦 2024-10-17 08:02:03

您可以使用我们的眼睛使用的技术来获得深度和距离的透视。

1)从两个不同的相机位置获取同一物体的两张图像。

2)两幅图像中物体之间的距离或像素与相机和物体之间的距离成反比。

该实现位于 https://github.com/agnelvishal/Distance- Between -相机和物体
这是研究论文 http://dsc.ijs.si/files/papers /S101%20Mrovlje.pdf

You can use the technique used by our eye to get perspective of depth and distance.

1) Get 2 images of the same object from two different camera positions.

2) The distance or pixels between object in 2 images is inversely proportional to distance between camera and object.

The implementation is available at https://github.com/agnelvishal/Distance-between-camera-and-object
Here is the research paper http://dsc.ijs.si/files/papers/S101%20Mrovlje.pdf

在风中等你 2024-10-17 08:02:03

您可以通过手机的加速度计获得角度。如果计算这个角度的正切并将其乘以相机镜头的高度,就可以得到距离。

You have the angle in the phone's accelerometer. If you calculate the tangent of this angle and multiply it by the height of the camera lens, you get the distance.

一个人的旅程 2024-10-17 08:02:03

我认为这个应用使用 MisterSquonk 提到的方法(免费)。观看“三角学”技术。

I think this App uses the approach MisterSquonk mentioned (its free). Watch the "Trigonometry" technique.

月下凄凉 2024-10-17 08:02:03

我认为通过使用 FastCV 你可以计算相机和物体之间的距离。在这种情况下,您不需要知道您在地面上方持有的相机的角度或位置。看看这个问题这里

I think by using FastCV you can calculate the distance between Camera and the object. In this You dont need to know the angle or the Position of camera that you are holding above ground Level. take a look at this question here

我是有多爱你 2024-10-17 08:02:03

实现此目的的一种方法是使用设备中的 DPI。您可以拍照并计算高度。但是您需要另一个对象作为参考,然后您将能够知道此方法的问题可能是对象之间的视角

One way to achieve this is using the DPI's in your device. You can take a picture and calculate the height. But you'll need another object as a reference and then you will be able to know the problem with this method could be the perspective between the objects

就像说晚安 2024-10-17 08:02:03

我认为使用手机摄像头可以做到这一点。我知道现代手机使用镜头来聚焦物体。如果可以知道它们的焦距和它们聚焦于所选物体的位置(位移),那么也可以确定距离

I think it could be possible doing that using the phone camera. I know that the modern phones use lenses to focus on a object. If it is possible to know their focal length and their position(displacement) to focus on the chosen object it's also possible to determinate the distance.

゛清羽墨安 2024-10-17 08:02:03

不可以。仅适用于立体声模式下的两个摄像头,例如 xbox 360 kinect。至少需要 3 个点来三角测量距离。

No. Only with two cameras in stereo mode, like the xbox 360 kinect. It takes at least 3 points to triangulate distance.

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