4

I am seeking an Android solution to calculate the distance to an object and then determine the size (height, width, length).

Example would be a bridge, building.

Lii
  • 11,553
  • 8
  • 64
  • 88
Robert Linn
  • 49
  • 1
  • 2

4 Answers4

2

This information is not available in a single image. It would be possible using stereoscopic imaging i.e. take two images spatially separated with some (not insignificant) processing.

Although the focus control might appear to give out of band information on depth in practice it would be very inaccurate with a camera with such a small sensor at anything beyond a few feet since the depth of field is very large.

1

You can't.

Consider the ship on following image: enter image description here

Even Human eyes with brain can't perform such task, when there are 2 of them(so that 3d is theoretically possible). With 1 camera it is impossible geometrically.

Most advanced visual systems in the world(astronomy, NASA) measure distance using other ways (ultra-red radiance, other waves).

If you find the distance you find everything through angles. If you >1 cameras and know both sets of angles you can find 3D parameters by basic school geometry.

phaberest
  • 3,140
  • 3
  • 32
  • 40
iantonuk
  • 1,178
  • 8
  • 28
0

For this problem I recommend these links:

Yesterday I wrote a short program (which nevertheless took me 2 hours) to get the x,y,z coordinate values to calculate the angle of the phone. Referring to the first link I want to calculate the distance to an object. With these x,y,z coordinates + the height in which I hold the camera it should be possible. I just want to try this in a room - interested in the precision.

Community
  • 1
  • 1
gartenabfall
  • 260
  • 1
  • 6
  • 15
  • 1
    Can you explain how do you get the angle "a" as shown in first link. We can get the "h" but i dont know how to get "a". Can you please help me? Thanks in advance. – Smeet Sep 05 '11 at 10:35
-1

to get the "a" you find the z accelerometer value. convert it to a double. use the a = Math.ToRadians(a) function. Then a = Math.tan(a). Then a = a * h.

Andro Selva
  • 53,910
  • 52
  • 193
  • 240
Lance
  • 49
  • 4