NOTE: Microsoft has released Kinect SDK since this article was written. You probably want that instead of this. :)
Much of the stuff I’m doing with Kinect involves two input pictures and one output I figured I’d make a platform to make it easy to test new stuff. The main idea is that I can add multiple modules (functions) to one application without messing up old code for each new.
It’s all bound to the GUI through MVVM (ModuleEngine is the View).
Since this sample code has some sample modules that does some silly processing it is easy to understand it and build your own. Therefore I figured this is a great place to start for wannabee Kinect-hackers. Just buy a Kinect, install the drivers and start up this project (Look in the Modules-folder).
It is still buggy though, but I’ll keep improving it for the next few days.
Update: The disappearing image has been solved by using a backbuffer. This also allows me to convert image into a 32-bit Bgra in the same pass so we can work on the depth map with Int32 pointers instead of byte pointers (the problem was that the image was 24-bit so we’d have to fake a 3 byte structure to be able to make an usable pointer… nasty).
Basically I’m making a simple platform where I can add executes custom classes that gets 2 pictures in and writes one out. If a class in the assembly uses IProcessModule it will be listed in the combobox as well as initialized when selected. If the module needs input (like InvisibleEffect) there is a button to send a signal. The modules process raw data in unsafe context (pointers).
I’m using the idea (and a 10-20 lines of code) from CL NUI .Net sample to link a BitmapSource directly to the same memory area that Freenect writes to. I’ve also copied some of the Kinect initialization code from Freenect C# sample as well as using the Freenect C# wrapper library.
I’m thinking BSD licensing, but need to consider how much code I’ve borrowed and from what license it came.