在ARCore中检测垂直平面

在ARCore中检测垂直平面

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

问题描述

我想知道是否有人使用ARCore SDK实时识别了设备前方的垂直平面.

I was wondering if someone was managed to identify vertical planes ahead of the device in realtime using the ARCore SDK.

通过使用线方程定义墙,我获得了不错的成绩:

I was managed to achieve decent result by defining a wall using a line equation:

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

通过对每个y"的注释,我的意思是我忽略了y轴(如从房间的2d映射中从上面看墙壁),以计算定义墙壁的线.

by "for every y" comment I meant that I ignore the y axis(looking at the wall from above as in 2d mapping of a room) in order to calculate a line that defines the wall.

乘数是两点之间的旋转:

the Multiplier is the rotation between the points:

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
}

现在,我在用户走动并触发许多点云点时触发该计算.

Now I trigger that computation while the user is walking around and samples many point cloud's points.

结果不错,但不如ARCore的水平面检测准确.

The results are good but not as accurate as the horizontal plane detection of the ARCore.

推荐答案

现在是ARCore的一部分,已发布在版本1.2.0 适用于Android

Now is part of ARCore, was release on version 1.2.0 for android

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

08-16 06:32