问题描述
我一直在尝试计算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
可能,我使用这样的东西:
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
整个过程将如
-
查找匹配项(如上所述)
find matches (as you mentioned)
使用 findhomography从这些匹配查找单应矩阵
function
find homography matrix from these matches using findhomographyfunction
- 使用warper,seamfinder和blender进行最终拼接输出
这篇关于估计R / T从同位素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!