Detecting vertical planes in ARCore

6.4k views Asked by At

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)

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;

The all computation is:

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.

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

3

There are 3 answers

0
Canato On BEST ANSWER

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

0
Kitwradr On

You can refer to this issue on official Google AR Core github repo https://github.com/google-ar/arcore-unity-sdk/issues/31 . This feature is released in ARCore SDK for unity (v1.2.0) SDK link as mentioned in the issue. Hope this helps :)

0
Andy Jazz On

Since ARCore 1.2 was released we can use four values of Config.PlaneFindingMode enumeration.

Here's how a code looks like:

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.