【问题标题】:Could having auto focus enabled be causing tracking issues in my AR scene?启用自动对焦是否会导致我的 AR 场景出现跟踪问题?
【发布时间】:2019-07-15 15:52:47
【问题描述】:

我正在使用 AR Core 和 Unity 2018.2.20f 在 Galaxy S7 上构建 AR 场景,我使用 AugmentedImageVisualizer 跟踪图像并在前面放置一个 3d 游戏对象。为了跟踪图像,我需要启用自动对焦。问题是我的锚四处抖动,有时完全移开并消失。从调试来看,似乎是相机自动对焦可能导致了跟踪问题。

到目前为止,我最好的解决方法是在检测到图像后将相机配置切换为固定,但在切换到固定焦点时锚点移动的时间有 1/3。如果在相机固定焦距后锚点仍在视线内,则跟踪效果很好。

以前有没有其他人注意到这个问题?有没有办法更具体地控制相机对焦?

【问题讨论】:

    标签: unity3d augmented-reality arcore


    【解决方案1】:

    如果您使用 ARCore 1.9 或更高版本,则增强图像的跟踪比以前的版本有所改进。请从下面的链接中找到正式版本。

    链接: https://github.com/google-ar/arcore-unity-sdk/releases

    就调试而言,在自动模式下进行配置会很好。有时,如果您在配置中同时使用平面跟踪和增强图像,可能会出现抖动。

    此外,无需使用增强可视化工具来检测增强图像。以下代码可以帮助跟踪增强图像并放置任何 3D 对象。

    using GoogleARCore;
    
    private List<AugmentedImage> augmentedImages = new List<AugmentedImage>();
    
    public GameObject AndyObject;//object to place on the image
    
    private bool Is_Placed=false;
    
    void Update()
    {
      Session.GetTrackables<AugmentedImage>(augmentedImages, 
                              TrackableQueryFilter.Updated);
      foreach (var image in augmentedImages)
      {
        if (image.TrackingState == TrackingState.Tracking &&     Is_Placed==false)
        {
           Anchor anchor=image.CreateAnchor(image.CenterPose);
           var andyref = Instantiate(AndyObject,image.CenterPose.position,
                                         image.CenterPose.rotation);
           andyref.transform.parent=anchor.transform;
           Is_Placed=true;//To only place the object once
         }
       }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-03-16
      • 2015-04-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多