给定第一个摄像头的姿势,估计校准后的立体装备的第二个摄像头的姿势 [英] Pose estimation of 2nd camera of a calibrated stereo rig, given 1st camera pose

查看:71
本文介绍了给定第一个摄像头的姿势,估计校准后的立体装备的第二个摄像头的姿势的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用opencv我已经校准了一对立体声摄像机.这样会导致两个摄像机之间发生旋转和平移.

Using opencv I've calibrated a pair of cameras in stereo. This results in a Rotation and Translation between the two cameras.

我使用第一个相机(左)拍摄图像,然后使用solvePnp计算左相机相对于零件的姿态(rvec和tvec).

I take an image using the 1st camera (left) and use solvePnp to calculate the pose (rvec and tvec) of the left camera relative to a part.

我的问题是如何使用左镜头的姿态和给定的R& amp;来计算右镜头的姿态.立体声校准的T值?

My question is how to I calculate the pose of the right camera using the pose of the left camera, and the given R & T values from the stereo calibration?

谢谢.

推荐答案

这个问题尚不清楚,但我认为您想找到合适的相机相对于相机的姿势部分.在这种情况下,最简单的处理方法如下:

The question is a bit unclear, but I think that you would like to find the pose of the right camera with respect to the part. If this is the case, the easiest way to proceed is as follows:

  • 让Q_pl为左摄像机相对于零件的姿态.这由一个4x4矩阵表示,其前3行和第3列是零件w.r.t的旋转矩阵R_pl.左摄像机(您的rvec),最下面一行是[0,0,0,1],第4列的最上面3行是摄像机 的转换向量t_pl 的组成部分em 部分(您的tvec).为了明确起见,您可以通过将零件的x,y和z轴单位向量在摄像机框架中的纵坐标写为列向量(从摄像机中看到)来写Q_pl,然后是来自<的向量相机 零件,然后将[0,0,0,1]写入第四行.
  • 同样,令Q_lr为左摄像机相对于右摄像机的姿势(从校准中获得).您编写了这个4x4矩阵,将左摄像机的x,y,z单位向量的分量(如右图所示)放置为列向量,然后是右摄像机 的平移向量 em>到左边,然后将[0,0,0 1]写为第四行.
  • 零件的姿势正确的相机就是两个矩阵的乘积:

  • Let Q_pl be the pose of the left camera with respect to the part. This is represented by a 4x4 matrix whose first 3 rows and columns are the rotation matrix R_pl of the part w.r.t. the left camera (your rvec), the bottom row is [0, 0, 0, 1], and top 3 rows of of the 4 column are the component of the translation vector t_pl from the camera to the part (your tvec). To clarify, you write Q_pl by writing, ordinately, the component in camera frame of the x, y and z axis unit vectors of the part (as seen from the camera) as column vectors, followed by the vector from the camera to the part, and then write [0, 0, 0, 1] as the fourth row.
  • Likewise, let Q_lr be the pose (obtained from the calibration) of the left camera with respect to the right one. You write this 4x4 matrix laying the components of the x, y, z unit vectors of the left camera (as see from the right one) as column vectors, followed by the translation vector from the right camera to the left one, and then write [0, 0, 0 1] as the fourth row.
  • The pose of the part w.r.t. the right camera is then simply the product of the two matrices:

Q_pr = Q_pl * Q_lr

Q_pr = Q_pl * Q_lr

请注意,因素的顺序很重要.该表达式只是说,要从右侧的摄像头转到零件,您可以先从右侧的摄像头转到左边的摄像头,然后再从那里转到零件.同样,此变换的旋转部分位于Q_pr的前3行和3列中,从右摄像机到该部分的转换向量在第4列中.

Note that the order of the factors matters. This expression simply says that to go from the right camera to the part, you can first go from the right camera to the left one, and then from there to the part. Again, the rotation part of this transformation is in the top 3 rows and 3 columns of Q_pr, and the translation vector from the right camera to the part is in the 4th column.

请注意,您的校准程序可能给了您Q_rl,而不是Q_lr.如果是这种情况,您只需将其反转即可.倒数很容易计算:

Note that your calibration procedure may have given you Q_rl, rather than Q_lr. If this is the case, you just invert it. The inverse is very easy to compute:

R_lr = transpose(R_rl)
t_lr = -(R_lr * t_rl)

同样,如果这是您的solvePnP产生的,那么您将反转Q_lp,而不是Q_pl.

Likewise, you'll invert Q_lp if that's what your solvePnP produced, rather than Q_pl.

这篇关于给定第一个摄像头的姿势,估计校准后的立体装备的第二个摄像头的姿势的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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