问题描述
我试图检测垂直平面(如墙壁)以在垂直平面上添加图像视图.但是没有找到垂直平面.根据会话的默认配置,可以找到两个平面作为水平和垂直平面.但找不到纵向计划.
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
的最简单方法是使用以下代码(确保调用一次,因此它无法创建新的 锚定
每次更新):
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:无法检测垂直平面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!