Kinect Point Cloud Normals Rendering – Part 1

That’s a bit of a mouthfull as a title – but it encapsulates all the things I’m hoping to cover in this post and the end goal. The first step is to create a point cloud using the depth data that we get from the Kinect camera. To do this we’ll need the calibration details we obtained previously (see ) and the geometry of the “Pinhole Camera”. If you look up the Wikipedia article on the Pinhole camera model you will find that this model describes the mathematical relationship between the coordinates of a 3D point and its projection onto…
Read more →

Kinect V2 Depth Camera Calibration

I wanted to calibrate my Kinect V2 Depth Camera in order to obtain it’s intrinsics. With those I can then create point clouds, normals, etc.. It’s the starting place for a lot of interesting computer vision things. We can calibrate the Kinect V2 Depth Camera in a similar way to how we would calibrate the Colour Camera. There’s an excellent program called GML C++ Camera Calibration Toolbox which is just what you need to do the calibration. It’s produced by the Graphics and Media Lab at Lomonosov Moscow State University. Once you’ve downloaded and installed the toolkit it needs a…
Read more →

Polymorphism and Abstract in C#

Let’s say you want to define a base class that other classes will inherit from:

We want to make sure that everything that inherits from this class will implement its own version of the CreateBrushes() method. If this method isn’t implemented then we will get a runtime exception every time our inherited class is instantiated. This is one way of ensuring that inherited classes provide an implementation of a method. However, we only find out the problem at runtime. A better solution would be to get an error at compile time. This is where the abstract keyword comes in….
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 →