Stereo vision: Depth estimation

和自甴很熟 提交于 2019-12-03 09:55:56

问题


I am working on Stereo vision task and I would like to get the distance between stereo vision cameras and the object. I am using Matlab with Computer Vision System Toolbox.
I have calibrated cameras with using "Camera Calibration Toolbox for Matlab" thus I have Intrinsic parameters of left and right camera and Extrinsic parameters (position of right camera wrt left camera). I have also a pair of rectified pictures and thier disparity map. For estimation of disparity I have used Matlab function disparity(). I know the baseline and the focal length of cameras but my results are still wrong.

baseline = 70 mm
focal length = 25 mm
disparity = 60 pixels
---------------------
depth = baseline * focal length / disparity = 70 * 25 / 60 = 29 mm

But I know that the distance is cca 600 mm. Is this formula right? What about the units? mm * mm / pixel != mm. And especially I would like to use Camera matrix (Intrinsic parameters) for calculation but I didn't figure out how. I would be thankful for any hint.


回答1:


Like you said, you have to convert the unit into mm. And for that you need this formulas

z = (b*F) / (d*s)

mm = (mm * mm) / (pixel * (mm/pixel)) 

Where

  • z = depth in mm
  • b = baseline in mm
  • F = focal length in mm
  • d = depth in pixel
  • s = sensor size in mm/pixel. (Normally it provide in um, so do conversion before).

EDIT

Sometime your focal is in pixel so you don't need to use the sensor size. So just use your formula :

z = b*F / d
mm = mm * pixel / pixel


来源:https://stackoverflow.com/questions/19956910/stereo-vision-depth-estimation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!