Oren
Oren

Reputation: 258

Project Tango - 3D Reconstruction

I'm trying to use the C 3D Reconstruction Library to get a mesh from the Tango device. In the Mesh Building Functions there's a summary of the flow to use, which shows that I have to call the Tango3DR_update function several times and then call the Tango3DR_extractFullMesh to get the mesh.

The problem is that Tango3DR_update needs the Tango3DR_PointCloud object which I don't see how I get. I can create an empty Tango3DR_PointCloud using Tango3DR_PointCloud_create, but I don't see anywhere how I fill it with real data.

Does anyone know how to get this object? Or anyone knows if there's any example / sample code using this library? I didn't find any.

Thanks, Oren

Upvotes: 0

Views: 785

Answers (1)

Julien
Julien

Reputation: 934

You should fill the Tango3DR_PointCloud from the TangoXYZij you receive in OnXYZijAvailableRouter. Same thing for the pose struct.

// -- point cloud
Tango3DR_PointCloud cloud;
cloud.num_points = xyz_ij->xyz_count;
cloud.points = new Tango3DR_Vector4[cloud.num_points];
for (int i = 0; i < cloud.num_points; ++i) {
  cloud.points[i][0] = xyz_ij->xyz[i][0];
  cloud.points[i][1] = xyz_ij->xyz[i][1];
  cloud.points[i][2] = xyz_ij->xyz[i][2];
  // last is confidence
  cloud.points[i][3] = 1;
}
cloud.timestamp = xyz_ij->timestamp;

(Do not forget to delete [] cloud.points once you're done)

The only official example I could find is in the Unity examples. They use the C API but called from C#.

Upvotes: 2

Related Questions