'Android: Unable to detect vertical plane
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.
Solution 1:[1]
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.
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;
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |