【问题标题】:ARCore: Get get 2d co-ordinate from an anchor or poseARCore:从锚点或姿势获取 2d 坐标
【发布时间】:2020-12-13 20:03:41
【问题描述】:

这是我用来获取所有特征平面的代码。

                            while (planeIterator.hasNext()){
                                    Plane plane =  planeIterator.next();
        
                                    if(plane.getTrackingState() == TrackingState.TRACKING && 
    (plane.getType() == Plane.Type.VERTICAL||plane.getType() == Plane.Type.HORIZONTAL_UPWARD_FACING)){
        
                                    Iterator<Anchor> anchors =  frame.getUpdatedAnchors().iterator();
                                   Anchor  newAnchor = plane.createAnchor(plane.getCenterPose());
                                 }
                             }

从文档中不清楚如何从锚点获取 3d 世界坐标。如果我能得到那个 3d 世界坐标,我可以使用

转换成 2D
ArFragment.getArSceneView().getScene().getCamera().worldToScreenPoint()

但是如何让 3D 世界与 newAnchor 协调?

【问题讨论】:

    标签: java android augmented-reality arcore plane


    【解决方案1】:

    我认为您是在询问锚点的姿势 - 这可以从 getPose() 方法获得:

    公共姿势getPose()

    返回锚点在世界坐标空间中的位姿。

    姿势被定义为对象的局部坐标映射,即如果您只看对象本身,则映射到世界坐标。它通常被描述为旋转后平移。旋转使对象指向正确的方向,或正确定向,然后平移将其移动到世界坐标中的正确位置。

    如果您查看 Pose 类,您可以从中查询您的用例所需的任何信息。

    一个简短的说明 - 我猜你知道但 Sceneform 没有被弃用,或者更准确地说是开源然后存档 - 见这里:https://developers.google.com/sceneform/develop

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-10-02
      • 2019-01-16
      • 1970-01-01
      • 1970-01-01
      • 2017-01-16
      • 1970-01-01
      • 2016-08-04
      相关资源
      最近更新 更多