--- title: Computer Vision - Depth Perception created_date: 2025-03-26 updated_date: 2025-03-26 aliases: tags: --- # Computer Vision - Depth Perception ## Stereo Vision ### Disparity Map [This blog article](https://www.baeldung.com/cs/disparity-map-stereo-vision) explains nicely what disparity maps are. And [this blog article](https://johnwlambert.github.io/stereo/) goes more into the math and physics of it. - The disparity is the apparent motion of objects between a pair of stereo images[^1]. - The depth is inversely proportional to the disparity. If we know the arrangement of the cameras, then the disparity map can be converted into a depth map using triangulation. - When disparity is near zero (far away) then small differences produce large depth differences. When disparity is large, small disparity differences do not change the depth significantly. Hence, stereo vision systems have high depth resolution only for objects relatively near the camera. #### Correspondence Problem To compute the disparity map we must first find out corresponding pixels of the two stereo images. [Image rectification](https://en.wikipedia.org/wiki/Image_rectification) is used to #### At OSD ``` disparity = (baseline * focal_length) / depth DISPARITY_CONSTANT = baseline * focal length ``` --- [^1]: Experiment: close one eye, then open the eye while closing the other eye and repeat. All objects close to you seem to move back and forth very fast, the objects that are far away seem to remain still.