0

我最近一直在研究视觉里程计。问题是,当我使用 OpenCV 中的 solvePnPRansac 时,它在计算特定一对图片的矩阵时会输出一个过大的平移向量。

我使用 ORB 作为检测器,使用蛮力匹配作为匹配器,并进行了比率测试以获得良好的匹配,使用 PnP 后的关键点如下

3d-2d pairs: 14 14 399. // 14 is the number of matches before using PnP, below are inlier returned from the solvePnPRansac

inliers -> keypoints_1: [259.2, 409.2]inliers -> keypoints_2: [252, 412.8]
inliers -> keypoints_1: [238.464, 416.448]inliers -> keypoints_2: [231.552, 419.904]
inliers -> keypoints_1: [254.016, 404.352]inliers -> keypoints_2: [247.104, 407.808]
inliers -> keypoints_1: [122.688, 392.256]inliers -> keypoints_2: [115.776, 399.168]
inliers -> keypoints_1: [331.776, 244.685]inliers -> keypoints_2: [321.408, 246.758]
inliers -> keypoints_1: [328.458, 94.5562]inliers -> keypoints_2: [316.017, 97.0445]
inliers -> keypoints_1: [297.404, 204.241]inliers -> keypoints_2: [286.655, 207.825]
inliers -> keypoints_1: [286.655, 218.574]inliers -> keypoints_2: [275.905, 222.157]
inliers -> keypoints_1: [275.905, 218.574]inliers -> keypoints_2: [265.155, 222.157]
pnp OK = 0, inliers point num = 9
solve pnp in opencv cost time: 0.00605066 seconds.
R=
[-0.3390034706688646, 0.8875045658950799, 0.3121094237440614;
 0.646880874083814, 0.4607807301122591, -0.6076399044679127;
 -0.6830971977830278, -0.004094419690165774, -0.7303159960649745]
t=
[82422858130.12387;
 -42954154618.24076;
 -589700410154.9523]
Rt [-0.3390034706688646, 0.8875045658950799, 0.3121094237440614, 82422858130.12387;
 0.646880874083814, 0.4607807301122591, -0.6076399044679127, -42954154618.24076;
 -0.6830971977830278, -0.004094419690165774, -0.7303159960649745, -589700410154.9523;
 0, 0, 0, 1]

我已经将 keypoints_1 中点的坐标转换为相机帧,我给solvePnPRansac的参数如下:

solvePnPRansac(pts_3d, pts_2d, K, Mat(), r, t, false, 600, 0.5, 0.95, inliers, SOLVEPNP_ITERATIVE);

如你所见,平移向量变得很奇怪,怎么这么大是我无法理解的,我也想问最好设置的重投影误差是多少,因为 0.5 是我随机给出的一个数字。

非常感谢您的帮助,在此先感谢大家。

4

0 回答 0