https://photo.stackexchange.com/a/12437/61513 here is a formula for calculating distance if we know the size of the object.

Can I use this method for photos/frames made by Android cameras? And if I use landscape orientation for capture image do I still have to use sensor height or it should be width? (and also other parameters - object, image - width or height)?

enter image description here

  • Yes, same method, formula – Romeo Ninov Mar 13 '17 at 15:17
  • 3
    I'm curious as to why you might think that an Android camera would be an exception to the basic formula. – Please Read Profile Mar 13 '17 at 15:54
  • @RomeoNinov so I always should use this formula even if I use an image with landscape orientation? I don't have to change to sensor height to width? – user25 Mar 13 '17 at 19:43
  • 1
    @user25 Clearly, use whichever dimension is appropriate for the orientation for "height". – Please Read Profile Mar 14 '17 at 1:23

This is actually a simple ratio problem you can solve easily with a basic calculator .
We can a trace light ray coming from the top of the object to the lens. We can a trace light ray coming from the bottom of the object to the lens. These traces describe a triangle. The base of this triangle is a trace from the center of the object to the center of the lens. This is called the object triangle.

Light waves travel through the lens and fan out tracing out a triangle called the image triangle. The two triangles are the same as to their angles thus the length of the sides and the base trace out similar triangles, all the angles are the same however the lengths and base are not the same but they have the same ratio.

Given your description you know two things about the image triangle. You know its height; this will be the focal length of the taking lens. You also known the length of its base; this is a measurement taken from the imaging chip’s height or width. Say the focal length is 6mm and the chips, height is 10mm. We can divide these values and find a ratio. Thus 10 ÷ 6 = 1.66. This is the ratio height to base.

From your description we known height of the object. The distance to the object is unknown. Since the object triangle and the image triangle are similar we can use the ratio we have just calculated to find the distance to the object.

Say the height of the object is 14 feet. The distance to the object will 14 X 1.66 = 23.24 feet.

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