4
$\begingroup$

I came across an application that:

[...] shows the distance to objects seen through the camera lens of your [device]. Simply aim your [device] to any object in your surroundings, and [the application] displays the distance towards that object on top of the camera image. [...]

How does it work? [The application] uses the height of the camera lens and its tilt angle to calculate the distance to the object.

I am confused. How does the height of a camera lens and a tilt angle allow to calculate a 3D distance? I thought that a point on a 2D space (what a camera sees) represents a line in 3D so it's impossible to calculate real distance with 1 camera and no objects of reference.

$\endgroup$
1
$\begingroup$

The first thing I think of from that description is that it is just using trigonometry to determine the distance.

triangle picture

(This is just an image I found online that looked usable in this example)

i.e. - point N is the camera, B is the object, 7.5 is the height of the camera, and 53.1 is the angle the camera is held at relative to a line normal to the ground. Knowing this info, you can calculate the distance to B -->

12.5 = 7.5/cos(53deg)

The orientation would come from the accelerometer/gyroscope/magnetometer (also called an IMU or MARG sensor) in the phone. While the height could come from a barometric pressure sensor, or some other form of altitude sensor. Honestly, I have no idea how they would get the height from the standard sensors inside a smartphone. Because most smartphones don't care how high you are.

Alternatively, some software can calculate 3D distance/record 3D video using the shake of the camera to simulate the two viewpoints necessary for actual 3D vision. For example, a VR game like pokemonGO might want to ensure that the pokemon are always on the ground or on a surface as opposed to floating in midair. So they would take two pictures in quick succession and then use the displacement of the camera in that time to determine the distance to a solid surface. And then use that information when drawing the pokemon to the screen.

$\endgroup$
0
$\begingroup$

It uses your height (ie the height of the camera lens) above the ground together with the tilt of the camera (from it's internal gyroscope sensor)

The trick is that if finds the ground plane in the image(by image processing) and then measures the angle to the ground at the point the object touches it.

Once you have that distance you can get the height / width from the distance and knowing the focal length of the camera

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy