Creat mesh from point cloud on a 2D grid

2.2k views Asked by At

I am using the new Kinect v2 and I am getting the depth map of the Kinect. After I get the depth map I convert the depth data from Depth Space to Camera Space. As far as I understand this is done, by converting all the X,Y coordinate of each pixel to Camera Space + adding the depth value as Z coordinate (also Kinect gives the depth value in millimetres so it is also converted to hold meters). Because of this, the point cloud is actually on 2D grid extended with the depth value. The visualization also confirms this, since it is easy to notice that the points are ordered in a grid due to the above conversation.

For visualization I am using OpenGL the old fashion way (glBegin(...) and glEnd()). I want to create a mesh out of the points. I kind of managed to do it with GL_TRIANGLES, but then I have lot of duplicated vertices and edges. So I thought I should create a better triangulation with GL_TRIANGLE_STRIP, but I am stuck here because I can't come up with a good algorithm which can go through my 2D grid in a way that I can feed it to the GL_TRIANGLE_STRIP so it creates a nice surface.

The problems:

  • For each triangle's vertices I am checking the Z coordinate. If it exceeds a certain threshold I disregard the triangle => this might create holes in my 2D grid.

  • Some depth values are NaN, because the Kinect can't "see" there nothing (for example an object is too far or too close) => this also creates holes in the 2D grid.

Anybody has any suggestion what would be the best method to solve this issue?

2

There are 2 answers

0
Deepfreeze On BEST ANSWER

If you're able to use the point cloud library, you could use the class pcl::OrganizedFastMesh< PointInT >.

http://docs.pointclouds.org/trunk/classpcl_1_1_organized_fast_mesh.html

I use it to triangulate complete depth frames.

0
Micromega On

You can try also a delanauy triangulation in 3d and look for the tetrahedons on the exterior. An easy algorithm is the bowyer-watson with tetrahedons and circumspheres. Cgal is a good example.