Why does distance calculated from an image change when I zoom?
Asked 10/25/2012
4 views
2 answers
0
I'm estimating the distance from my camera to an object in a photo using its known size. My subject is a 40 mm table-tennis ball. The formula works fairly well, but when I zoom the lens and recalculate the distance from another shot, the result changes. Besides updating focal length, is there anything else in the equation that needs to change when zooming?
Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0
Photography Stack Exchange contributor
13y ago
2 Answers
4
Theoretically the only factor you should need to adjust for in the following equation when zooming is the focal length:
$$\text{Distance to object [mm]} = \frac{f\,[\text{mm}] \times \text{real height [mm]} \times \text{image height [px]}}{\text{object height [px]}\times \text{sensor height [mm]}}$$
There is one factor to be aware of, the distance to object in this equation is actually the distance from the object to the centre of projection of the lens (usually somewhere in the middle of the lens on the optical axis).
However, the centre of projection will usually move when you zoom or focus a lens. The original question was about finding the distance to a windmill, so if the centre of projection moved a few cm it would have a negligible effect on the answer. But if you are attempting to measure very close objects it could skew the result.
What is more likely though is the EXIF reported focal length is only approximate, most lenses only supply about 8 different values for focal length. Not only that but the focal length written on the lens is also inaccurate (it's usually rounded to the nearest 5mm for marketing purposes), and the lens focal length will likely change when focussing also.
In short a camera is a poor tool for measuring distances, especially at close range where a far more accurate solution is possible using a tape measure.
Originally by user1375. Source · Licensed CC BY-SA 4.0
user1375
13y ago
0
Generated from our catalog & community — verify before relying on it.
In the ideal case, the same formula still works when you zoom — but you must update both the focal length and the object's size in the image (its height/diameter in pixels). If only focal length changes in your calculation, the result will be wrong.
Another practical issue is that the formula gives distance to the lens’s center of projection, not necessarily to the camera body or front of the lens. On zoom lenses, and often when focusing, that point can shift. For distant subjects this barely matters, but for a small nearby subject like a 40 mm ping-pong ball, even a small shift can noticeably change the calculated distance.
So the variation you see is most likely due to:
- not remeasuring the ball’s size in pixels after zooming, and/or
- the lens’s effective projection point moving as you zoom or focus.
If the ball stays the same size in pixels after zooming, then the camera-to-subject distance must also have changed.
Recommended products
UniqueBot
AI13y ago
Your Answer
Related Questions
Can a 50mm lens image a 3mm object full-frame on a 5.2×3.9mm sensor, and are my distance calculations correct?
Why does my distance-from-photo calculation give a much smaller result than expected?
How can I estimate an object's real size from one image if I know the camera-to-subject distance?
Can you determine focal length from the aperture used on a zoom lens?
What determines spatial resolution in an industrial camera image?