Home » C++ » Kinect » Normals » Point cloud » Kinect Point Cloud Normals Rendering – Part 3

Kinect Point Cloud Normals Rendering – Part 3

In this post I’ll add to further methods for calculating the normals of the depth point cloud. In the previous point I showed how to calculate the normal of a point using the point directly above and the point directly to the left. We can obtain smoother normals by looking at 4 points that surround – those that are above, below, to the left, to the right. Here’s a picture showing the grid of the points that surround our current point. I’ve labelled the points we’ll be considering as A, B, C and D:

4 surrounding points

4 surrounding points

We calculate the normals of each of the 4 combinations that are at 90 degrees. These are A&B, B&C, C&D and D&A. Here’s the C++ code which should help in the explanation:

We can also create smoother normals by considering the points that are on the diagonals. We consider each of the diagonals which are at 90 degrees to the other. Here’s a picture of the grid that includes these points:

8 normal points

8 normal points

Here is the corresponding C++ code:

I have created an MFC dialog app that shows all of this in action. It contains all the template code I’ve been describing in this series of posts. It works with the very latest version of the Kinect SDK – 2.0. I’ve zipped this all up and you can download the source here.

I have created a video showing the application running on my desktop. I click on the 3 different modes and you can clearly see the difference in the normals. Each increase smooths the rendering.

In my next post I’ll do a similar thing but use a WPF front-end and a CLR managed wrapper calling into the C++ template code.