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

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

问题描述

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

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. 使用已知参考作弊:

例如,如果您有一个已知大小的物体,则可以推断距离.例如,这类似于美国宇航局校准其相机的工作.

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天全站免登陆