无法检测垂直平面

无法检测垂直平面

本文介绍了Android:无法检测垂直平面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试检测像墙这样的垂直平面,以在垂直平面上添加图像视图.但是没找到垂直平面.根据会话的默认配置,该会话可以将两个平面都查找为水平和垂直平面.但是找不到垂直的计划.

I am trying to detect a vertical plane like wall to add image view on a vertical plane. But did not find the vertical plane. As per the default config for a session that can find both planes as a horizontal and vertical plane. But unable to find a vertical plan.

如何在android应用程序中查找垂直平面?

How to find a vertical plane in android application?

请帮助我.

推荐答案

首先,您需要一个合适的垂直表面进行跟踪.具有纯色(没有任何区别特征)的墙是非常不好的情况.跟踪垂直表面的最可靠方法是光线明亮的砖墙或上面贴有图片的墙壁等.

Firstly, you need an appropriate vertical surface for tracking. Wall with a solid color (with no distinguishing features on it) is very bad instance. The most robust approach for tracking of a vertical surface is a well lit brick wall, or a wall with pictures on it, etc.

其次,在检测到的平面中心创建Anchor的最简单方法是使用以下代码(请确保调用一次,因此它无法在每次更新时创建新的Anchor) :

Secondly, the easiest way of creating an Anchor in the center of your detected plane is to use the following code (make sure you call it once, so it couldn't create a new Anchor on every update):

Anchor newAnchor;

for (Plane plane : mSession.getAllTrackables(Plane.class)) {

    if (plane.getType() == Plane.Type.VERTICAL &&
        plane.getTrackingState() == TrackingState.TRACKING) {

        newAnchor = plane.createAnchor(plane.getCenterPose());
        break;
    }
}

这篇关于Android:无法检测垂直平面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 12:45