Kinect Point Cloud Normals Rendering – Part 4

In this post I’ll create a WPF front-end to the C++ template code I’ve been using so far. I’ll use a CLR wrapper to achieve this. The first step is to create a WPF project. I like to use MVVM Light Toolkit for my WPF projects. I’ve installed the Visual Studio plugin so it comes up as on option when I’m creating a new project. I started by created a project called DepthViewer2D: Once I created this project I added a new project to the solution called DepthImageRenderer. This is a C++/CLR class library project. You’ll find it under “Other…
Read more →

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: We calculate the normals of each…
Read more →

Kinect Point Cloud Normals Rendering – Part 2

Having shown you how to create a 3D point cloud from a Kinect depth map in Part 1 I will now go on to explain how to calculate the normals for that point cloud and then render that in 2D by mapping the (x,y,z) normal vector values to R-G-B channel values. To calculate the normal for a given 3D point in the point cloud we will use the point directly to the left of it (i.e. at the point (x-1,y)) and the point directly above it (i.e. at the point (x,y-1)). We will create a triangle of the 3 points…
Read more →

Parallel Processing and Lambda expressions in C++11 – Part 2

If you’ve made the changes to the code from Part 1 then you already have code that should be working dramatically faster. In the next steps I’m going to use C++ templates to further enhance the code. I love C++ templates! I try and use them whenever I can. One of the great things about them is that only the code that is actually used gets generated and compiled. And with C++11 you’ve got the ability to use lambda functions in templates. This is useful if you’re using STL. It’s also useful for us here. Before I do that I…
Read more →

Parallel Processing and Lambda expressions in C++11 – Part 1

One of the exciting new features introduced with C++11 is lambda expressions. .NET has had these for a while so its nice to be able to use them in C++ too. A common task in video processing and graphics is to perform some operation over an image. When doing this you’ll typically process the image buffer a row at a time as this speeds up processing. Microsoft have introduced the Concurrency Runtime with their C++11 compiler. This gives you the ability to process the image in a parallel fashion. If you’ve got Visual Studio 2013 and have installed the help,…
Read more →

Polymorphism in C++ and C#

I went for an interview for a C++ job one time and they showed me the following code and asked me what the output would be:

Really this is a question about inheritance and polymorphism in C++. The class description is the base class and the classes sphere and cube inherit from it. Because the description has declared it’s method print() as virtual a vtable is created under the hood for that class and method. Any class that derives from description is allowed to override it’s definition of print() and use its own. The definition of the print() method…
Read more →