# How to calculate the distance of an object in a photo?

I am going to be carrying out some experiments for school in physics class where I will need to calculate the distance a tennis ball travels. I am going to be filming it, and I was wondering if a paused the video at the moment the ball makes contact with ground, would I be able to find the distance of the ball from the camera which will be a in a fixed position?

The camera will be my iPhone 7, as I don't have any other cameras. Also, does the height of the camera above the ground matter? Say I have it at a height of 2m above the ground, will it affect the calculations of finding the distance of the tennis ball from the picture?

• Welcome to Photo at Stack Exchange. Questions that involve using a camera to do something else (measure something for a physics experiment) rather than to produce a photograph for the sake of artistic photography aren't really on topic here. Your question is more of a physics question that asks how to use a camera as a measuring device. Perhaps you could get a better answer at physics.stackexchange.com? Mar 2 '18 at 14:26
• In theory you could calculate the FOV of the camera, then calculate how many pixels wide the ball would be at x distance. Using that you would be able to calculate distance. Mar 2 '18 at 15:56
• I'm voting to close this question as off-topic because it is about using a camera to measure something, rather than to produce a photograph as the end result. Mar 2 '18 at 23:21

This question is not so much about photography as it is about designing an experiment and the measurement of the experiment.

I suggest doing what the Mythbusters do: build a measured board or sheet with distance marker lines or gridlines, as a "backdrop" right behind the ball.

Another example, from Instructables.com

• Other mythbusters episode had hinted upon how to calculate real-world sizes from frames. In the Jaws special, Adam Savage analyzed frames of the shark cage, determined the ratios between the width of the bars on the frame to what kind of tubing may be used, and build an equivalent. Knowing the size of your tennis ball in real life, and other benchmarks in the frame could help. Mar 2 '18 at 19:51
• @Calyth that's along the lines of the suggestion in the comments to the question. You're right, that would work. However, a simpler, more immediately obvious measurement of only the data in the image is what I'm suggesting. It's the same reason why forensic photographers use forensic rulers (often substituted with coins or dollar bills in TV procedurals) when photographing evidence: all the information you need is in the image data itself, rather than in the metadata.
– scottbb
Mar 2 '18 at 20:20

Your best bet to accurately determine the distance is to simply and directly use a regular measuring tape. Then there is no question about it.

But if you know your cameras sensor size (size in both mm and pixels), and if you know its lens focal length (these are relatively difficult questions to find out for most small cameras), then there is a calculator at https://www.scantips.com/lights/subjectdistance.html that will compute the distance. It will be as accurate as your answers about the camera (which may often be a bit suspect for precision of any technical endeavor). This distance is of course from the camera, and NOT from wherever the ball came from.

If the camera is 2 meters high, and for example located 2 meters from the subject, then this lens path is a 45 degree angle down, and so is 1.414x longer camera distance than the horizontal floor distance. You will need to use the camera distance. In your test situation, you could measure that too, or use trig to compute it.

Objects close to the camera reproduce larger as compared to things further from the camera. Place the tennis ball on the floor at a measured distance from the camera. Make a series of pictures of the tennis ball at precisely measured distances.

View each image using a standardized setup. Measure the diameter of the image of the tennis ball using a precision meaning device. You can procure a 10-power loop with reticle ruled with labeled circle diameters. Such a magnifier is available from a lithographic supply house or Edmund Scientific.

Make a chart of distance vs. image size. This will work if you standardized camera position and zoom and viewing conditions.