tracker.py 文件源码

python
阅读 37 收藏 0 点赞 0 评论 0

项目:AMBR 作者: Algomorph 项目源码 文件源码
def compute_rectification(ms_rig):
    """
    :type ms_rig: MultiStereoRig
    :param ms_rig:
    :return:
    """
    for stereo_rig in ms_rig.rigs:
        im_size = stereo_rig.cameras[0].intrinsics.resolution
        rotation1, rotation2, pose1, pose2, Q = \
            cv2.stereoRectify(cameraMatrix1=stereo_rig.cameras[0].intrinsics.intrinsic_mat,
                              distCoeffs1=stereo_rig.cameras[0].intrinsics.distortion_coeffs,
                              cameraMatrix2=stereo_rig.cameras[1].intrinsics.intrinsic_mat,
                              distCoeffs2=stereo_rig.cameras[1].intrinsics.distortion_coeffs,
                              imageSize=(im_size[1], im_size[0]),
                              R=stereo_rig.cameras[1].extrinsics.rotation,
                              T=stereo_rig.cameras[1].extrinsics.translation,
                              flags=cv2.CALIB_ZERO_DISPARITY)[0:5]
        stereo_rig.cameras[0].stereo_rotation = rotation1
        stereo_rig.cameras[1].stereo_rotation = rotation2
        stereo_rig.cameras[0].stereo_pose = pose1
        stereo_rig.cameras[1].stereo_pose = pose2
        stereo_rig.extrinsics.inv_rotation = np.linalg.inv(stereo_rig.extrinsics.rotation)
        stereo_rig.Q = Q
        stereo_rig.f = Q[2, 3]
        stereo_rig.inv_baseline = Q[3, 2]
        stereo_rig.ox = Q[0, 3]
        stereo_rig.oy = Q[1, 3]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号