gpt4 book ai didi

android - ARCore Pose 和 Aruco estimatePoseSingleMarkers

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:20:45 26 4
gpt4 key购买 nike

我有一个服务器功能,可以从图像中检测和估计 aruco 标记的姿势。

使用函数 estimatePoseSingleMarkers 我找到了旋转和平移向量。我需要在带有 ARCore 的 Android 应用程序中使用此值来创建姿势。

文档说 Pose 需要两个 float 组(旋转和平移):https://developers.google.com/ar/reference/java/arcore/reference/com/google/ar/core/Pose .

float[] newT = new float[] { t[0], t[1], t[2] };
Quaternion q = Quaternion.axisAngle(new Vector3(r[0], r[1], r[2]), 90);
float[] newR = new float[]{ q.x, q.y, q.z, q.w };
Pose pose = new Pose(newT, newR);

在此姿势中放置的 3D 对象的位置是完全随机的。

我做错了什么?

这是估计和绘制轴后来自服务器图像的快照。 我收到的图像旋转了 90°,不确定它是否与任何东西有关。 image server with axis

最佳答案

cv::aruco::estimatePoseSingleMarkers ( link ) 返回 Rodrigues 中的旋转向量格式。按照文档

w = norm( r ) // angle of rotation in radians
r = r/w // unit axis of rotation

因此

float w = sqrt( r[0]*r[0] + r[1]*r[1] + r[2]*r[2] );
// handle w==0.0 separately
// Get a new Quaternion using an axis/angle (degrees) to define the rotation
Quaternion q = Quaternion.axisAngle(new Vector3(r[0]/w, r[1]/w, r[2]/w), w * 180.0/3.14159 );

除了提到的直角旋转外,应该可以工作。也就是说,如果镜头参数被正确地或达到一定的精度馈送到 estimatePoseSingleMarkers

关于android - ARCore Pose 和 Aruco estimatePoseSingleMarkers,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54078932/

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