【问题标题】:Camera Trajectory Estimation with Visual Odometry使用视觉里程计进行相机轨迹估计
【发布时间】:2020-04-11 17:05:39
【问题描述】:

我有一个问题,我有一组图像并且必须根据第一张图像的帧计算相机轨迹。

在 OpenCV 中,有很多方法可以首先在图像中找到特征,然后在图像之间进行匹配,然后再应用视觉里程计。

    """
    Estimate complete camera trajectory from subsequent image pairs

    Arguments:
    estimate_motion -- a function which estimates camera motion from a pair of subsequent image frames
    matches -- list of matches for each subsequent image pair in the dataset. 
               Each matches[i] is a list of matched features from images i and i + 1
    kp_list -- a list of keypoints for each image in the dataset
    k -- camera calibration matrix
    """ 

    for i in range(len(matches)):
        match = matches[i]
        kp1 = kp_list[i]
        kp2 = kp_list[i+1]
        depth = depth_maps[i]

        rmat, tvec, image1_points, image2_points = estimate_motion(match, kp1, kp2, k, depth)
        R = rmat
        t = np.array([tvec[0,0],tvec[1,0],tvec[2,0]])

        P_new = np.eye(4)
        P_new[0:3,0:3] = R.T
        P_new[0:3,3] = (-R.T).dot(t)
        P = P.dot(P_new)

        trajectory.append(P[:3,3])

    trajectory = np.array(trajectory).T   
    trajectory[2,:] = -1*trajectory[2,:]

estimate_motion 中,旋转矩阵和平移向量被返回,但此时相对于 image1。由于我想获得第一张图像的帧中的轨迹,因此我必须将其转换为该帧,但我不明白:

  • 为什么P_new[0:3,0:3] = R.T 会被转置
  • 为什么P_new[0:3,3] = (-R.T).dot(t) 是负号

【问题讨论】:

  • 为什么不使用光流来计算鼠标控制器的运动?
  • @lamourettejean-baptiste 光流可用于 VO,但这不是 OP 问题。这里有一些Visual Odometry 主题的参考资料。

标签: python opencv


【解决方案1】:

看看齐次变换。

这里是从Handbook of Robotics中提取的一些快照:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-12-21
    • 1970-01-01
    • 2020-12-07
    • 1970-01-01
    • 2022-08-04
    • 1970-01-01
    • 2015-11-29
    • 1970-01-01
    相关资源
    最近更新 更多