立体视觉:深度估算 [英] Stereo vision: Depth estimation

查看:192
本文介绍了立体视觉:深度估算的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从事立体视觉任务,我想了解立体视觉相机与物体之间的距离.我正在将Matlab与Computer Vision System Toolbox一起使用.
我已经使用用于Matlab的相机校准工具箱"对相机进行了校准,因此我具有左右相机的固有参数和外部参数(右相机相对于左相机的位置).我也有一副校正过的图片和他们的视差图.为了估计视差,我使用了Matlab函数disparity().我知道相机的基线和焦距,但是我的结果仍然是错误的.

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

但是我知道距离是cca 600毫米.这个公式对吗?单位呢? mm * mm / pixel != mm.特别是我想使用Camera矩阵(本征参数)进行计算,但我不知道如何进行计算.如有任何提示,我将不胜感激.

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.

推荐答案

就像您说的那样,您必须将单位转换为mm.为此,您需要此公式

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)) 

哪里

  • z =以毫米为单位的深度
  • b =基线,单位为毫米
  • F =焦距,单位为毫米
  • d =像素深度
  • s =传感器尺寸,单位为毫米/像素. (通常以um形式提供,转换之前也是如此).

编辑

有时您的焦点位于像素中,因此您无需使用传感器尺寸.因此,只需使用您的公式即可:

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

这篇关于立体视觉:深度估算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆