5

I took a picture with Samsung S4 phone. Is it possible to determine the distance to the object on the picture?

The object is in focus. I looked at the JPG picture properties but could not find anything indicating to the distance. The focal length is fixed on this camera, it's 31mm in 35mm equivalent scale.

  • Do you know the size of the object? – mattdm Apr 12 '14 at 11:29
  • @mattdm, no. In fact the reason I'm looking for a distance is to determine the size – Aksakal Apr 12 '14 at 13:56
  • 1
    That makes a big difference to the answers. – mattdm Apr 12 '14 at 14:04
3

You can use this equation:

Distance of an object (in meters) =

   (focal length (mm) * object height (m) * image height (px))
   -----------------------------------------------------------
       (object height in image (px) * sensor height (mm))
  • 2
    See the comments. Size of object is not known. – mattdm Apr 12 '14 at 14:04
  • @mattdm ah! well 2 unknown variables is a a problem, hope OP can estimate one of them. gotta work with what you have! – silenT_Thunder Apr 12 '14 at 17:02
0

If it is in the file, exiftool will tell you.

If not, there is no easy way to tell the distance as cameras basically record angle information (in the picture - each pixel looks at a specific direction from an idealized center). If you have two or more photos from different viewpoints, then you could use PanoTools or similar tools to create a 3D mesh, and if you know some physical lengths then you could derive the distance to your object. (And you know some physical locations: your eye or camera level, and also the ground level, let's not forget it).

  • thanks, i'm surprised that cameras do not record auto-focus information. – Aksakal Apr 10 '14 at 15:17
  • Well - they record focal length and in-focus indicators. :-) But distance to subject needs triangulation, so two pictures. – TFuto Apr 10 '14 at 15:33
  • @TFuto - it doesn't need triangulation. It does however need to know the exact stetting of the focus and the atmospheric conditions. Focus can change slightly based on humidity and such and generally lenses don't measure the exact position of the focus. If you did know the exact setting of the focus though, then the distance to subject can be calculated without any triangulating. – AJ Henderson Apr 10 '14 at 19:50
  • 1
    @AJHenderson: Your reasoning is only valid if the person uses an extremely shallow depth-of-field, like one in microscopes (a long teleobjective is a good approximation). If he is using large DOF and not long focal length, the successive approximation or heuristics of focusing just gets a good enough focus lock. Imagine a very extreme scenario: an ultra wide angle lens. That has focus from 30 cm to infinity. So okay, you have a focus lock, but the relative error is so big, that data is not useful. My opinion... – TFuto Apr 10 '14 at 20:25
  • 2
    Ah using the relative angles it the scene to determine relative angle. OK. I'm on board now. – AJ Henderson Apr 10 '14 at 22:18
0

Most lenses don't measure the position of the focus, just which direction they need to move in order to reach focus. Therefore they can't measure the exact position of the focus. If the data isn't already in the EXIF information of the photo, then it likely is not able to be captured by the camera.

  • it makes a sense then, i was wondering why don't they report the position of the focus. i'd love to look at low level specifications of the phone cameras – Aksakal Apr 10 '14 at 19:36

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.