KinectContrib 2.0 released - now supports Kinect for Windows SDK 1.0
Join the DZone community and get the full member experience.Join For Free
KinectContrib is a project I started, trying to extend the capabilities of the default Kinect for Windows SDK. As I am working on more complex components, I decided that it would be easier to start with something a lot of developers will need - Visual Studio templates that provide the skeleton for basic Kinect application types.
I worked last night and today to finally make the project compatible with the new Kinect for Windows SDK, that recently hit version 1.0. There were many breaking changes that required me to refactor large chunks of code. At the end of the day, it is all working as it should. You can download the bits by following the links below.
As usual, you can download the source code here:
The current template set includes projects for C#, VB .NET and F#.
Speaking of which, I had some interesting moments while building the F# part. With the new SDK, the image is no longer returned as a separate entity but rather as a byte array. This requires me to handle array resizing in C# and VB.NET - not that big of a problem for an experienced developer. But I haven't had a chance to work a lot with F#, so that's when I found out that Array.Resize might not be the perfect choice.
Take a look at these fragments:
let ds : byte = Convert.ToByte(1) let dummySkeleton : Skeleton = new Skeleton(TrackingState = SkeletonTrackingState.Tracked) // Thanks to Richard Minerich (@rickasaurus) for helping me figure out // some array concepts in F#. let mutable pixelData : byte array = [| |] let mutable skeletons : Skeleton array = [| |]
Initially, I didn't think of these arrays as mutable. So I tried directly resizing them to no avail. Later, Richard Minerich, a F# MVP, suggested that I re-create the array instead. So in the re-initialization parts of the code, I used something like this:
pixelData <- Array.create r.PixelDataLength ds
This solved one problem, but I had to jump yet another hoop. As I was testing the C# "harness", I noticed that I can get a tracked skeleton while I am sitting in a chair - the camera sees me from waist up. This was good, however, when I tried to test the same code translated to F#, the skeleton tracking was not working. As it turns out, for an unknown (at the moment) reason, the F# application reacts in a weird way to a waist-up user position, not seeing the skeleton. Once I stand up, so the camera caught my full height, everything works fine.
This should not generally affect performance and can be considered a potential SDK/hardware limitation.
PS: The released templates should also be compatible with the Kinect for Windows sensor.
Opinions expressed by DZone contributors are their own.
Revolutionizing Algorithmic Trading: The Power of Reinforcement Learning
How To Use Geo-Partitioning to Comply With Data Regulations and Deliver Low Latency Globally
Mastering Time Series Analysis: Techniques, Models, and Strategies
Never Use Credentials in a CI/CD Pipeline Again