问题
I'm new to Tango and I wanted to scan a room to
- detect walls and color them red
- detect floors and color blue
I reviewed the Tango tutorial where you can place a cat. Looks like there's a FindPlane
function that takes a touch position.
Is this something I can use to distinguish walls from floors?
回答1:
Did you find the Floor Finding Example.
Also, the Java API since Caporales has better 2D Floor Plan extracion.
I've not seen anything existing about detecting Walls I'm afraid. Once you've reliably got the floor, walls could be identified by making sure the plane is perpendicular to the floor.
Edit: Response to Comment.
So after a quick look I think I would start by taking TangoPointCloud._FindFloorWithDepth()
and modifying it to look for the highest depth points instead of the lowest (giving us the Ceiling!).
Now you know how high to draw your wall planes. It sounds like you are happy finding all the planes which are perpendicular to the floor.
We should start with the simplest case of looking at a flat rectangle wall with no cutouts (doors windows etc..), and no objects in the way. We could take our set of all planes which are Perpedcidular to the Floor/Ceiling, and keep only those with transform.forward
pointing towards the player. Iterate through those and calculate the average distance they are away, giving us where to position the wall. Also, take the maximum value seen to the Right and to the Left, giving us how long the wall is.
So we have the height from taking Cieling-Floor
, we have the width taking maxRight-maxLeft
, and we have the position averaged from the planes.
来源:https://stackoverflow.com/questions/42234011/how-to-detect-floor-and-other-surfaces-in-google-tango