简体   繁体   English

如何使用OpenCV计算2帧之间的旋转平移矩阵

[英]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功能(例如,使用ORBBFMatcher ),
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.

相关问题 使用OpenCV进行摄像机校准:使用失真和旋转平移矩阵 - Camera Calibration with OpenCV: Using the distortion and rotation-translation matrix 在OpenCV中使用旋转和平移矩阵 - Using Rotation and Translation Matrix in OpenCV 我们如何计算在opencv中使用的两个立体声摄像机的旋转和平移StereoRectify(r,t参数) - How can we compute rotation and translation two stereo cameras to use in opencv StereoRectify(r,t argument) 如果我知道3D中的齐次变换矩阵,如何使用opencv查找旋转和平移角度? - How to find the angle of rotation and translation using opencv if I know the homogeneous transformation matrix in 3d? 使用基本矩阵使用 OpenCV 计算坐标平移 - Use fundamental matrix to compute coordinates translation using OpenCV object opencv 的旋转和平移 - rotation and translation of object opencv 如何在两个不同坐标系中的对应点之间找到旋转和平移(变换矩阵) - How to find rotation and translation (transformation matrix) between corresponding points in two different coorinate systens solvePnP:获取旋转平移矩阵 - solvePnP: Obtaining the rotation translation matrix 如何根据我的旋转和平移矩阵计算Inliers点? - how to calculate the inliers points from my rotation and translation matrix? ICP变换矩阵平移和旋转 - ICP transformation matrix translation and rotation
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM