Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to measure distance to object with camera?

Is it possible to measure distance to object with phone camera?

I mean, in my application I start the camera, facing the camera to the object (lets say house) and then press the button and it calculates the distance and shows me in screen.

If it's possible where I can find some tutorial or information about it?

like image 341
evilone Avatar asked Jan 03 '11 21:01

evilone


People also ask

Is it possible to measure distance with camera?

The distance between the projection plane and the lens of the camera is image distance. Object distance can be obtained by applying image distance to lens formula. This method is proved to be effective and a single distance measurement can be performed within 3.21ms.

How do you measure distance in photography?

This 168/300 pixels or 2724/4912 pixels is simply computing the size as 56% of the 24 mm height of the camera sensor. Then knowing 56% of the camera sensor height in mm, and also the real life height, and the focal length distance in camera, it calculates distance to the subject.

How is object distance measured?

The measured distance is determined on the basis of one view of an object presented on one image. The image is made at a constant and invariant setting of the optical path such as: focus, aperture and focal length. The article presents a method of measuring the dis- tance to an object through digital image processing.


2 Answers

I accept the question has been answered adequately (with the obvious caveats of requiring level ground and possible accuracy problems) but for those who don't believe it can be done or that it needs a video camera, let me explain the low-level math needed to do it....

alt text

The picture above shows me standing outside my house. The horizontal (d) is the distance I want to measure and the vertical (h) is the height above the ground at which I'm holding the camera. In this case 'h' is a known value when I'm holding the android camera at eye-level (approx 67 inches or 1.7 metres). When I tilt the camera to aim it directly at the point my house meets the ground, all the software needs to do is work out the angle (a) relative to vertical and it can calculate 'd' using...

d = h * tan a 
like image 140
Squonk Avatar answered Sep 22 '22 01:09

Squonk


Well you should read how ithinkdiff.com "measures" the distance:

Uses the angle of the iPhone to estimate the distance to a point on the ground. Hold the iPhone in front of you, align the point in the camera and get a direct reading of the distance. The distance can then be used in the speed tool.

So basically it takes the height of where you hold the phone (eye-level), then you must point the camera to the point where object touches the ground. Then the phone measures the inclination and with simple trigonometry it calculates distance.

This is of course not very accurate. It gets less accurate the further the object is. Also it assumes that the ground is level.

like image 22
Peter Knego Avatar answered Sep 20 '22 01:09

Peter Knego