估计R / T从同位素 [英] Estimating R/T from Homography

查看:375
本文介绍了估计R / T从同位素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试计算2个图片中的功能,然后将这些功能传回 CameraParams.R ,没有运气。特征被成功计算和匹配,然而,问题是将它们传递回 R&

I've been trying to calculate the features in 2 images and then pass those features back to CameraParams.R without luck. The features are calculated and matched successfully, however, the problem is passing them back to R & t.

我知道你必须分解 Homography 可能,我使用这样的东西: https://github.com/syilma/homography-

I understand that you must decompose the Homography in order for this to be possible, which I've done using something like this: https://github.com/syilma/homography-decomp, but am I really doing it right?

现在我只是使用:

匹配:

vector< vector<DMatch> > matches;
Ptr<DescriptorMatcher> matcher = DescriptorMatcher::create(algorithmName);
matcher->knnMatch( descriptors_1, descriptors_2, matches, 50 );

vector< DMatch > good_matches; // Storing good matches here



我注意到 good_matches 不在任何地方使用。所以我想我的问题是,如何回传 good_matches cameras.R / t

提取同位体:

Mat K;
cameras[img_idx].K().convertTo(K, CV_32F);

findHomography -> decomposeHomography(H, K, outputR,outputT,noarray()).

然后通过使用上面的库,传递 R & t 但是回应是在4种可能的结果中找不到单应性。

Then by utilizing the library above, I pass in the values from R & t but the response is that the homography isn't found in the 4 possible outcomes.

正确的路径在这里?看起来像decomposeHomography是一个3D解决方案,但findHomography是2D?

Am I on the right path here? Seems like decomposeHomography is a 3D solution, but, findHomography is 2D?

绝对目标:

根据图像中找到的功能,优化 CameraParam.R / t

Refine CameraParam.R/t depending on the features found in the images.

为什么?因为我目前从设备旋转矩阵传递 .R ,但旋转稍有不准确。请参阅我上一个问题的详情:优化相机参数和计算错误 - OpenCV

Why? Because I'm currently passing in the .R from the devices rotation matrix but the rotation is slightly inaccurate. See more info about it on my previous question: Refining Camera parameters and calculating errors - OpenCV

推荐答案

如果使用计算的R进行图像拼接,则不需要使用decompose单应性。整个缝合管道假定零平移。所以它给出了完美的输出只有旋转情况和轻微的错误引入了翻译的相机姿势。

If you are using the calculated R for image stitching, then there is no need to use decompose homography. Whole stitching pipeline assume zero translation. So it gives perfect output for only rotation case and slight error is introduced with the introduction of translation in camera pose. If you look into opencv calculation of R from homography, it assumes 0 translation.

Mat R = K_from.inv() * pairwise_matches[pair_idx].H.inv() * K_to;
cameras[edge.to].R = cameras[edge.from].R * R;

您可以在motion_estimators.cpp - > calcRotation函数中找到源代码。
关于使用goodmatches计算R的问题。goodmatches实际上用于使用 findhomography 函数计算单应性矩阵

You can find the source code in motion_estimators.cpp ->calcRotation function. Coming to your question of using goodmatches for calculating R. goodmatches are actually used to calculate homography matrix, using findhomography function

整个过程将如


  1. 查找匹配项(如上所述)

  1. find matches (as you mentioned)

使用 findhomography从这些匹配查找单应矩阵
function

find homography matrix from these matches using findhomography function


  1. 使用warper,seamfinder和blender进行最终拼接输出


这篇关于估计R / T从同位素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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