Tv2 - Terminator, Kinect for Windows v2 conversion...
- Posted: Aug 19, 2014 at 6:00 AM
- 8,625 Views
I got my hands on a Kinect2 last week so I decided to re-write the Terminator program using the Kinect2 api. Microsoft made some major changes to the domain api (no more skeleton frame, now using a body) but the underlying logic is still the same. Therefore, it was reasonably easy to port the code. There is plenty of places in the V2 api that are not documented yet but because I did some work in the V1 api, I could still get things done. For example, the V2 api documentation and code samples use event handlers to work with any new frame that arrives from the Kinect. This lead to some pretty laggy code. However, by using polling on a second thread, I was able to get the performance to where it needs to be. Also, a minor annoyance is that you have to use Win8 with the Kinect 2.
So here is the Terminator application, Gen 2. The UI is still just a series of UI controls:
This is pretty much like V1 where the video byte is being written to a WritableBitmap and the body is being drawn on the canvas. Note that like V1, the coordinates of the body need to be adjusted to the color frame. The API has a series of overloads that makes it easy to do the translation.
With the display working, I added in taking the photo, sending it to Azure blob storage, and having Sky Biometry analyze the results. This code is identical to V1 with the connection strings for Azure and Sky Biometry broken out into their own methods and the sensitive values placed into the app.config:
With the code in place, I can the run the Terminator Gen 2:
I think I am doing the Sky Biometry recognition incorrectly so I will look at that later. In any event, working with the Kinect V2 was fairly easy because it was close enough to the V1 that the concepts could translate. I look forward to adding the targeting system this weekend!!!
Project Information URL: http://jamessdixon.wordpress.com/2014/07/29/terminator-program-with-the-kinect-2/