gpt4 book ai didi

opencv - restorePose的参数 “triangulatedPoints”及其后面的数学

转载 作者:行者123 更新时间:2023-12-02 17:34:45 26 4
gpt4 key购买 nike

documentation所示,cv::recoverPose具有参数“triangulatedPoints”,尽管它背后的数学公式也未记录,即使在源(relevant commit on github)中也是如此。
当我使用它时,我得到以下形式的矩阵:

[0.06596200907402348, 0.1074107606919504, 0.08120752154556411, 
0.07162400555712592, 0.1112415181779849, 0.06479560707001968,
0.06812069103377787, 0.07274771866295617, 0.1036230973846902,
0.07643884790206311, 0.09753859499789987, 0.1050111597547035,
0.08431322508162108, 0.08653721971228882, 0.06607013741719928,
0.1088621999959361, 0.1079215237863785, 0.07874160849424018,
0.07888037486261903, 0.07311940086190356;

-0.3474319603010109, -0.3492386196164926, -0.3592673043398864,
-0.3301695131649525, -0.3398606744869519, -0.3240186574427479,
-0.3302508442361889, -0.3534091474425142, -0.3134288005980755,
-0.3456284001726975, -0.3372514921152191, -0.3229005408417835,
-0.3156005118578394, -0.3545418178651592, -0.3427899760859008,
-0.3552801904337188, -0.3368860879000375, -0.3268499974874541,
-0.3221050630233929, -0.3395139819250934;

-0.9334091581425227, -0.9288726274060354, -0.9277125424980246,
-0.9392374374147775, -0.9318967835907961, -0.941870018271934,
-0.9394698966781299, -0.9306592884695234, -0.9419749503870455,
-0.9332801148509925, -0.9343740431697417, -0.9386198310107222,
-0.9431781968459053, -0.9290466865633286, -0.9351167772249444,
-0.9264105322194914, -0.933362882155191, -0.9398254944757025,
-0.9414486961893244, -0.935785675955617;

-0.0607238817598344, -0.0607532477465341, -0.06067768097603395,
-0.06075467523485482, -0.06073245675798231, -0.06078081616640227,
-0.06074754785132623, -0.0606879948481664, -0.06089198212719162,
-0.06071522666667255, -0.06076842109618678, -0.06083346023742937,
-0.06084805655000008, -0.0606931888685702, -0.06071558440082779,
-0.06073329803512636, -0.06078189449161094, -0.06080195858434526,
-0.06083228813425822, -0.06073695721101467]

例如4x20矩阵(在这种情况下为20点)。我想将此数据转换为std::vector以便在solvePnP中使用它。怎么做,这里的数学是什么?谢谢!

最佳答案

OpenCV提供了 triangulatePoints 函数,该函数具有相同的输出:

points4D 4xN array of reconstructed points in homogeneous coordinates.



这表示每一列都是齐次坐标系中的3D点。但是,您的观点看起来并不像我期望的那样。例如,您的第一点是:
[0.06596200907402348, -0.3474319603010109, -0.9334091581425227, -0.0607238817598344]

但是我希望最后一个组件已经是1.0。您应该仔细检查这里是否有问题。您始终可以通过将每个尺寸除以最后一个分量来消除点的“缩放”:
 [ x, y z, w ] = w [x/w, y/w, z/w, 1]

然后将前三部分用于您的PnP解决方案。

我希望这有帮助

关于opencv - restorePose的参数 “triangulatedPoints”及其后面的数学,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52395169/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com