在ARCore中检测垂直平面

9

我想知道是否有人能够使用ARCore SDK在设备前实时识别出垂直平面。

通过定义一条线方程来定义墙,我成功地取得了不错的结果:

z = Multiplier * x + Constant (For every y)

“对于每个y”评论,我是指忽略y轴(从上面看墙壁,如房间的2D映射),以便计算定义墙壁的线条。

乘数是点之间的旋转:

let angleDeg = Float((360 - angle + 360) % 360) * Float.pi / 180.0;

全部计算如下:

let angle: Int = Int((atan2(pointA.z - pointB.z, pointA.x - pointB.x) * 180) / Float.pi) % 360
     yRotation = Float((360 - angle + 360) % 360) * Float.pi / 180.0

    if pointA.x == pointB.x {
         multiplier = Float.infinity
    } else {
         multiplier = (pointA.z - pointB.z) / (pointA.x - pointB.x)
    }
    constant = pointA.z - multiplier * pointA.x
}

现在我在用户步行时触发计算,对许多点云中的点进行采样。

结果还不错,但与ARCore的水平面检测精度相比略有不足。


1
有趣。其中几个示例视频显示物体在垂直墙上,因此我认为它们也是本地检测到的。 - user736893
有任何更新吗? - Russ Wheeler
还没有,我被调到另一个项目工作了几周。我可能会在两周内回来处理它。我可以分享的是,iOS使用ARKit实现了相同的方法,对他们来说效果非常好。 - Nativ
@gyochum 我正在使用Java,并且也是从示例项目开始的。我建议你fork这个存储库并添加自己的功能。然后你可以在这里链接你的解决方案和我打开的主要存储库拉取请求。 - Nativ
1
这个问题已经在最新版本(ARCore 1.0)中得到了部分解决。现在,您可以将对象放置在垂直表面上(检测点的法线已提供)。 - rkachach
显示剩余2条评论
3个回答

2

2
自从ARCore 1.2发布以来,我们可以使用Config.PlaneFindingMode枚举的四个值。
以下是代码示例:
public static final Config.PlaneFindingMode DISABLED
// Plane detection is disabled.

public static final Config.PlaneFindingMode HORIZONTAL
// Detection of only horizontal planes is enabled.

public static final Config.PlaneFindingMode VERTICAL
// Detection of only vertical planes is enabled.

public static final Config.PlaneFindingMode HORIZONTAL_AND_VERTICAL
// Detection of both horizontal and vertical planes is enabled.

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接