[英]How to compute rotation-translation matrix between 2 frames with OpenCV
I want to compute the rotation-translation matrix [R|t] matrix between 2 frames with OpenCV
(see http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html?highlight=fundamentalmat#camera-calibration-and-3d-reconstruction ) 我想用
OpenCV
2帧之间的旋转平移矩阵[R | t]矩阵(参见http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html?highlight=fundamentalmat#camera-calibration-和-3d重建 )
I know I have to : 我知道我必须:
1) Detect features on both frames (with SURF
, for example), 1)检测两个帧上的特征(例如,使用
SURF
),
2) Matche features (with ORB
and BFMatcher
, for example), 2)Matche功能(例如,使用
ORB
和BFMatcher
),
3) Compute the [R|t] matrix. 3)计算[R | t]矩阵。 The intrinsic parameters are known.
内在参数是已知的。
However, I don't know how to complete the third step with OpenCV
. 但是,我不知道如何使用
OpenCV
完成第三步。 Is there a regular/easy way to do this ? 有没有常规/简单的方法来做到这一点?
My aim is to compute the trajectory of a camera. 我的目标是计算相机的轨迹。
You will need to use RANSAC to compute either the Fundamental or Essential matrices 您需要使用RANSAC来计算Fundamental或Essential矩阵
OpenCV nicely provides the cv::findFundamentalMat
function to do so. OpenCV很好地提供了
cv::findFundamentalMat
函数。
Then it is a matter of getting [R|t]
from both A
, the intrinsic parameter matrix and F
, the fundamental matrix. 然后是从内部参数矩阵
A
和基本矩阵F
得到[R|t]
。 I would refer you to Extract Translation and Rotation from Fundamental Matrix for more information on that. 我将推荐您从基础矩阵中提取翻译和旋转,以获取更多相关信息。
You can simply use stereoCalibrate where your rotation & translation matrices are R & T respectively. 您可以简单地使用stereoCalibrate,其旋转和平移矩阵分别为R&T。 object_points, l_image_points, r_image_points coordinates of matched points/features in object and left/right image frames.
object_points,l_image_points,r_image_points对象和左/右图像帧中匹配点/要素的坐标。 stereoCalibrate(object_points, l_image_points, r_image_points, LcameraMatrix, LdistCoeffs, RcameraMatrix, RdistCoeffs, imageSize, R, T, E, F);
stereoCalibrate(object_points,l_image_points,r_image_points,LcameraMatrix,LdistCoeffs,RcameraMatrix,RdistCoeffs,imageSize,R,T,E,F);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.