Ask Your Question

# calculate distance using disparity map

i am wondering how can i calculate the distance between tow webcams(stereo vision) and an object in front of them using the disparity map?

edit retag close merge delete

## 1 answer

Sort by » oldest newest most voted

looking at this nice page, we get:

D:= Distance of point in real world,
b:= base offset, (the distance *between* your cameras)
f:= focal length of camera,
d:= disparity:

D = b*f/d

more

## Comments

it works but i'm getting the result in an matrix?!! is that ok?

oh, hehe. yes that's ok.

if you went and divided b*d ( a number ) by your disparity matrix, python will make a matrix as result.

every cell now contains the resp. distance at that point

can you give me the code for calculating distance using disparity?

1

How come pixel size isn't included in the formula?

Or is the pixel size implicitly included if we state disparity in the same measurment unit as focal length?

Official site

GitHub

Wiki

Documentation

## Stats

Asked: 2014-03-17 13:19:15 -0500

Seen: 8,139 times

Last updated: Mar 18 '14