4

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.

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220
Hemal Patel
  • 114
  • 1
  • 11
  • Maybe you can visualize the feature points and check if your vertical plane has enough features to be detected. – Ali Kanat Nov 12 '18 at 08:15

1 Answers1

4

In ARCore and ARKit, tracking of vertical surfaces is a bit more difficult to achieve than tracking of horizontal surfaces. Firstly, all you need is an appropriate surface for tracking. Wall with a solid color (with no distinguishing features on it) is very bad sample. The best sample for tracking of a vertical surface is a well-lit brick wall, or a wall with pictures on it, etc. The worst sample for tracking is a solid-color wall, or wall with repetitive texture pattern (like polka dot), or reflective/refractive surface.

The same principles apply to horizontal tracking.

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;
    }
}
Andy Jazz
  • 49,178
  • 17
  • 136
  • 220