英文:
How to get Rotation Quaternion of my android device in ARcore?
问题
我正在开发一个增强现实(AR)项目,正在开发ARCore应用程序。
我想使用当前帧获取旋转和平移信息。
当前的实现和我的环境如下:
private Session session;
Frame frame = session.update();
Pose pose = frame.getAndroidSensorPose();
float[] t = new float[3];
float[] r = new float[4];
Pose rhspose = new Pose(t,r);
Pose thispose;
thispose = pose.compose(rhspose);
float translation[] = thispose.getTranslation();
float orientation[] = thispose.getRotationQuaternion();
----环境\
Android Studio:版本4.0.1\
ARCore SDK:版本1.18.1\
设备:ASUS_A002
在接下来的页面中,我能够获得平移向量,但无法获得旋转向量。
旋转向量的值始终为0。
https://developers.google.com/ar/reference/java/com/google/ar/core/Pose
如何在帧上使用getRotationQuaternion()方法?\
感谢您的帮助。
英文:
I am working on an AR project, and developping ARCorea application.
I want to use the current frame and get a rotation and translation.
Current implementation and my environment is below;
private Session session;
Frame frame = session.update();
Pose pose = frame.getAndroidSensorPose();
float[] t = new float[3];
float[] r = new float[4];
Pose rhspose = new Pose(t,r);
Pose thispose;
thispose = pose.compose(rhspose);
float translation[] = thispose.getTranslation();
float orientation[] = thispose.getRotationQuaternion();
----environment
Android Studio:Ver.4.0.1
ARCore SDK:Ver.1.18.1
Device:ASUS_A002
Following the next page, I could get collect translation vector, but not rotation vector.
The rotation vector values are always 0.
https://developers.google.com/ar/reference/java/com/google/ar/core/Pose
How do I use getRotationQuaternion() for a frame?
Thanks for your helping.
答案1
得分: 2
我解决了我的问题。
thispose = pose.extractTranslation();
float translation[] = thispose.getTranslation();
thispose = pose.extractRotation();
float orientation[] = thispose.getRotationQuaternion();
谢谢。
英文:
I solved my question.
thispose = pose.extractTranslation();
float translation[] = thispose.getTranslation();
thispose = pose.extractRotation();
float orientation[] = thispose.getRotationQuaternion();
Thanks.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论