1

I'm new to Tango and I wanted to scan a room to

  1. detect walls and color them red
  2. 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?

zx485
  • 28,498
  • 28
  • 50
  • 59
Bulgogi AR
  • 11
  • 3

1 Answers1

2

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.

Jethro
  • 3,029
  • 3
  • 27
  • 56
  • Excellent. Thank you Jethro, this helps. Once the floor is determined, I think I can create a plane at the floor height: m_floorPlaneY and add a material to it to change color. – Bulgogi AR Feb 15 '17 at 19:37
  • Sorry, I am still pretty new to Unity. For walls: if (m_pointCloud.FindPlane(cam, touchPosition, out planeCenter, out plane)) { // check if plane is perpendicular to floor // But how do I create a plane that's the exact size of the wall so that I can apply a material to it? } – Bulgogi AR Feb 15 '17 at 19:44