Using geometric principles, based on this concept of parallax. Minimum viable way to do that is with two cameras with an overlapping field of view. The other wholly different way that you can figure ad from an image is by using what tyronny referred to as samanticus. It means recognizing that things that are small are probably far away, and things that are big are probably close.
The asinine "camera vs lidar" debates are blown apart into several, far more interesting pieces in this week's episode, as the gang is joined by longtime friend of the show Tarani Duncan and Jason Devitt, co-founder and CEO of Compound Eye. Discussion covers the multiple approaches to camera-based depth perception, the evolutionary vs ground-up approaches to autonomous vehicles, and a little lidar shade as a treat.