在不知道物体与相机之间的距离的情况下,如何从图像中获取物体的真实尺寸? [英] How to get the real life size of an object from an image, when not knowing the distance between object and the camera?

查看:14
本文介绍了在不知道物体与相机之间的距离的情况下,如何从图像中获取物体的真实尺寸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须制作一个移动应用程序来计算图像中物体的真实尺寸.

I have to make a mobile app that calculates the real life size of an object in an image.

我对此进行了一些研究,发现有帮助 [问题]:给定一张图片,你如何找到物体的高度?

I have done some research on it and found helpful [question]: How would you find the height of objects given an image?

相机的距离和现实生活中物体大小的关系其实并不复杂,传感器上物体的大小与现实生活中的物体大小的比例是一样的焦距与到物体的距离之比.

The relation of the distance of the camera and real life size of the object isn't actually that complex, the ratio of the size of the object on the sensor and the size of the object in real life is the same as the ratio between the focal length and distance to the object.

distance to object (mm) = focal length (mm) * real height of the object (mm) * image height (pixels)
                          ---------------------------------------------------------------------------
                          object height (pixels) * sensor height (mm)

但是如果距离未知,如何获得物体的实际高度值?

But how to get the value of real height of the object if distance is not known ?

从图像创建 3D 模型的工具是否具有现实生活中的尺寸?

Do the tools that create 3d models from images have real life dimensions?

推荐答案

简单的答案是你不能.

顺便说一句,这就是人类有两只眼睛的原因.如果要在没有已知距离的情况下判断大小,则至少需要两个参考点.这允许您对对象的位置进行三角测量,获取到它的距离,并使用您已知的焦距来计算大小.

Incidentally, this is why humans have two eyes. If you want to judge size without a known distance, you'll need at least two reference points. This allows you to triangulate the position of the object, get a distance to it, and use your known focal distance to calculate the size.

更复杂的答案是有办法解决这个问题,例如:

The more complex answer is there are ways around this for example:

  1. 使用已知参考作弊:

例如,如果你有一个已知大小的物体,你可以推断出距离.例如,这类似于 NASA 所做的来校准其相机.

For example, if you have an object of known size, you can infer the distance. This is similar to what NASA does to calibrate its cameras, for example.

如果您处理的是常见对象,例如分析建筑物图像时的一层高度,您可以做出安全的假设.

You can make safe assumptions if you're dealing with common objects, such as the height of one storey when analysing the image of a building.

移动你的相机:

这使您可以使用同一台相机获得多个参考点.

This allows you to get more than one reference point with the same camera.

我想您可以使用加速度计来准确测量在时间点 T1 捕获的图像与点 T2 之间的位置关系.这将为您提供两个相同主题的图像,它们之间的距离已知.然后,这使您可以像有两只眼睛一样进行三角测量.

I suppose you could use the accelerometer to accurately measure the positional relation between the image captured at point T1 in time and point T2. This would give you two images of the same subject with a known distance between them. This then allows you to triangulate as if you had two eyes.

我不知道正常的手持相机抖动是否足以进行三角测量,或者加速度计是否足够准确以惯性定位手机.

Whether normal hand-held camera jitters will be sufficient for triangulation, or whether the accelerometer will be accurate enough to inertially position the phone, I don't know.

假设距离:

如果您的应用旨在比较人手(或其他人体解剖结构)大小的物体,您可以放心地根据人们的自然行为假设距离.相机本身的焦距限制也将给出一个物体可以和仍然聚焦的范围的上限和下限.这可能会在可容忍的误差范围内.

If your app is designed to compare something on the scale of a human hand (or other bit of human anatomy), you can probably safely assume a distance based on what people will naturally do. The focus limits of the camera itself will also give an upper and lower range on how far an object can be and still be in focus. This will probably be within a tolerable margin of error.

正如您在问题中提到的,有一个完整的 子字段 专门用于这个问题,它是一个 活跃研究领域.

As you mention in your question, there is an entire subfield dedicated to this question, and it is an active research area.

这篇关于在不知道物体与相机之间的距离的情况下,如何从图像中获取物体的真实尺寸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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