Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

How to find a vertical plane in android application?

Please help me.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
500 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.

enter image description here

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;
    }
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...