微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用 OpenCV 进行立体视觉和校准的噪声视差和深度图

如何解决使用 OpenCV 进行立体视觉和校准的噪声视差和深度图

我一直在学习一些在线教程,从立体图像对生成深度图,结果相当复杂。在对相机进行立体校准和校正后,我得到 0.514 的对极误差。然而,在图像的所有校准和校正之后,得到的视差/深度图仍然非常嘈杂。

def get_rectified_pair(img_left,img_right):
    img_left_rectified = cv2.remap(img_left,undistortion_map_left,rectification_map_left,cv2.INTER_NEAREST)

    img_right_rectified = cv2.remap(img_right,undistortion_map_right,rectification_map_right,cv2.INTER_NEAREST)


def get_disparity(img_left,img_right):
    img_left_rectified,img_right_rectified = get_rectified_pair(img_left,img_right)   

    stereo = cv2.StereoSGBM_create(numdisparities=80,blockSize=21)
    disparity = stereo.compute(img_left_rectified,img_right_rectified)

    return (disparity / 16).astype(disparity.dtype)


disparity = get_disparity(*get_image_pair(1))

plt.figure(figsize=(10,6))
plt.imshow(disparity,cmap='gray')
plt.show()

最佳视差图如下:

disparity map

在使用 cv2.reprojectimageTo3d 将视差图转换为深度图后,它似乎可以很好地区分 3-5 英尺和 10 英尺远的物体,但对于所有以 3-5 英尺远为中心的物体就差了。>

对于 0.514 的极线误差,这些视差图和深度值是典型的吗?如果没有,我该如何改进这些结果?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。