How to get the real life size of an object from an image, when not knowing the distance between object and the camera?

后端 未结 1 954
借酒劲吻你
借酒劲吻你 2020-11-27 12:31

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

相关标签:
1条回答
  • 2020-11-27 12:48

    The simple answer is you can't.

    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. Cheat by using a known reference:

      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.

    2. Move your camera around:

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

      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.

    3. Assume a distance:

      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.

    0 讨论(0)
提交回复
热议问题