I want to create a Deep Learning model that measures the distance between the camera and certain objects in an image. Is it possible? Please, let me know some resources related to this task.


2 Answers 2


In general, calculation of distance between camera and object is impossible if you don't have further scene dependent information.

To my knowledge you have 3 options:

Stereo Vision

If you have 2 cameras looking at the same scene from a different point of view you can calculate the distance with classical Computer Vision algorithms. This is called stereo vision, or also multiview geometry. Stereo Vision is the reason why humans can infer the distance to objects around them (because we have 2 eyes).

Structure from Motion

You move your camera and therefore change your viewpoint and can essentially do stereo mapping over time. Structure from Motion

Scene Understanding

Why is it then still possible for a one-eyed person to infer depth to some extent? Because humans have lots of scene dependent understanding. If you see a rubber duck that takes half of your field of view, you know it's pretty close because you know a rubber duck is not big. If you don't know the size of rubber ducks it is impossible to know whether you see a big rubber duck that is far away or a small rubber duck that is really close.

This is where Deep Learning based models come into play. A recent overview over monocular depth estimation can be found in Zhao2020


You can use libraries OpenCV and Python to find the distance.

You can refer this : Vehicle detection and distance estimation.

Since you didn't mention about dataset,you may consider datasets and methods in this paper.

If your camera is fixed/has many objects infront of it,you might use nearest object around camera approach..This approach is extremely useful if you want to deal with latitudes and longitudes.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .