1
$\begingroup$

Let's say a person took an image like this enter image description here

I have access to all image attributes (like for example image format, resolution and so on), and I know the location of the person - basically the place where he made the photo. Also I know all the data about the camera - model, resolution and others.

Is there an algorithm that allows to calculate the real distance between a person and the object on the image?

enter image description here

$\endgroup$
  • $\begingroup$ It depends. You haven't provided us enough context to answer the question. What else is known? Are we required to work only with just the one image, or is it possible that you might have side information like the camera calibration parameters, might know the position of the camera and the house, etc.? $\endgroup$ – D.W. Jun 11 '18 at 15:19
  • $\begingroup$ cs.stackexchange.com/q/56799/755 $\endgroup$ – D.W. Jun 11 '18 at 15:42
  • $\begingroup$ @D.W. the thing is that I am not sure what I need to calculate the distance. Should I know for example some GIS information to calculate the distances and so on. $\endgroup$ – lapots Jun 12 '18 at 7:58
  • $\begingroup$ There are multiple possibilities that might suffice. The more you can tell us about your situation, the more likely we can help. In any case, rather than adding clarifications in the comments, please edit the question so the question is self-contained and people don't need to read the comments to understand what you are asking. Thank you! $\endgroup$ – D.W. Jun 12 '18 at 15:45
  • $\begingroup$ @D.W. I added some details. Hope that helps! $\endgroup$ – lapots Jun 12 '18 at 19:10
2
$\begingroup$

No, it's not possible without extra information. Just think: if the house was 20 feet tall and 100 feet away, you couldn't distinguish that from the case where the house was 30 feet tall and 150 feet away. Those two would lead to exactly the same image.

Here are some possible options you could consider:

  1. If you have two pictures of the same house taken from two different positions, and you know the relative positions (e.g., one was 10 feet to the right of the other), then you may be able to infer the distance to the house, using parallax.

  2. If you know the height of some feature in the image -- say, the door -- and you know all of the camera parameters (in particular, the angular resolution of a single pixel or of the field of view), then you can work out the distance to the house. So if you could calibrate the camera in advance, and make a guess/assumption about the height of the door, you could draw an inference about the distance to the house.

    However this does require knowing all the camera parameters, which will probably require some calibration; I just knowing the image format, resolution, etc. and the camera resolution etc. will not be enough, and even knowing the model of the camera will probably not be enough. (Possibly if you knew the exact model of the camera and could go buy another camera of the same model, you might be able to calibrate the second one and assume both cameras have the same calibration. I don't know if that would work.)

See also Using Headpose Vector and 2D Points to Compute Distances. You might also look into camera intrinsics, camera extrinsics, the pinhole camera, and similar topics from computer graphics / computer vision.

$\endgroup$

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.