opencvcomputer-visiondisparity-mapping

does disparity maps give depth in meter if focal length and disparity are in pixel?


I am trying to find depth using a stereo camera. I created a depth map or disparity matrix which are from 0 to 255 (pixel value). Now after creating a depth map, I want to find real depth using formula,

depth = (baseline*focallength)/disparity-value
Here,
the baseline in (meter)
focal length in (pixel)
disparity-value in (pixel)

So I want to ask if I calculate depth, will that depth in pixel or in a meter.


Solution

  • If you substitute your units you get: depth = baseline (meter) * focal length (pixel) / disparity-value (pixel). So the result is in meters because pixels are canceled down.