python 深度 视差 计算,OpenCV-从视差图计算实际距离

在OpenCV中使用StereoSGBM算法计算了视差图,并进行了立体相机校准。通过公式(基线*焦距)/ 视差来计算实际距离,但结果与现实不符。对于近距离物体计算正确,远距离物体则出现误差。经过校准过程,包括图像重映射、去畸变和计算视差,但最终计算出的距离不准确。在OpenCV 2.4中,视差值是真实值的16倍,尝试将每个视差值除以16,但在OpenCV 3.0中不确定是否同样适用。
摘要由CSDN通过智能技术生成

I have computed disparity map using StereoSGBM algorithm in OpenCV 3.1. I have calibrated stereo camera with small RMS error. And now I want to compute real distance in mm for some points in disparity map.

This seems to be relatively easy problem. From what I understand I can simply use formula

distance = (baseline * focal length) / disparity

where I can use matrix Q (output from stereoRectify). Q[2][3] = focal length, 1/Q[3][2] = baseline.

The computed Q matrix is:

Q: !!opencv-matrix

rows: 4

cols: 4

dt: d

data: [

1., 0., 0., -1.5668458938598633e+02,

0., 1., 0., -1.1948609733581543e+02,

0., 0., 0., 2.3598119491957863e+02,

0., 0., 1.6254073321947445e-02, 0. ]

The problem is that the result does not correspond with the reality. For example, for the camera aimin

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值