Given an image of (part of) a sphere of known size, can one calculate the distance to the camera based on the relative size of the sphere in the image? My instinct is "no" unless you have some fixed parameters either for the camera, the resulting image, or at least an object in the foreground for reference.

Then you would attempt to calculate the size of the 2D sphere based on the visible segment and use some ratio to determine the distance as compared to the actual known thing.

Am I on the right track or how would you do this? In the example below, we could attempt to fix variable related to the camera or by using the humanoids in the bottom left corner.

Example Image

  • 1
    $\begingroup$ Can we assume the Earth is perfectly spherical? $\endgroup$ – HDE 226868 Oct 25 '14 at 19:14
  • 1
    $\begingroup$ I think we can since there are going to be a number of estimates in play anyways. $\endgroup$ – manofsteelanswers.com Oct 25 '14 at 19:17

You are right - if you know nothing at all about the camera, you can't figure this out.

Here is one way to approach the solution:

If you assume that the lens of the camera acts like a pinhole, then the outline of the sphere on the focal plane of the camera (film, sensor) would be a circle - and the center of the circle would correspond to the center of the sphere.

Therefore, if you can see enough of the edge of the sphere you can figure out how large the image of the sphere would have been on the focal plane. If you then know the focal length of the lens, and with what magnification you are looking at the image on the focal plane, you can figure out how big the angle is that the sphere subtends. Then you also need to know the distance to the sphere in order to compute its actual distance.

  • $\begingroup$ I think this only applies if the camera is facing down towards the center of the sphere. In this case, it appears the camera isn't facing straight down, and the edge forms a foreshortened circle aka an ellipse. $\endgroup$ – barrycarter Oct 26 '14 at 5:38
  • 1
    $\begingroup$ What if you had a banana for scale? (reddit joke...) $\endgroup$ – user6972 Oct 26 '14 at 8:24
  • $\begingroup$ @barrycarter you are right - I need to think this through more carefully and make some pictures. $\endgroup$ – Floris Oct 26 '14 at 8:30

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.