For the next two posts, we're going to do a mini-series on the new InteractionStream from Kinect for Windows SDK 1.7. Both focusing on using them outside of WPF.
Today's comes from Ben Lower...
Last month with the release of version 1.7 of our SDK and toolkit we introduced something called the InteractionStream. Included in this release were two new samples called Controls Basics and Interaction Gallery which, among other things, show how to use the new InteractionStream along with new interactions like Press and Grip. Both of these new samples are written using managed code (C#) and WPF.
One question I’ve been hearing from developers is, “I don’t want to use WPF but I still want to use InteractionStream with managed code. How do I do this?” In this post I’m going to show how to do exactly that. I’m going to take it to the extreme by removing the UI layer completely: we’ll use a console app using C#.
The way our application will work is summarized in the diagram below:
There are a few things to note here:
- Upon starting the program, we initialize our sensor, interactions, and create FrameReady event handlers.
- Our sensor is generating data for every frame. We use our FrameReady event handlers to respond and handle depth, skeleton, and interaction frames.
- The program implements the IInteractionClient interface which requires us to implement a method called GetInteractionInfoAtLocation which gives us back information about interactions happening with a particular user at a specified location:
- The other noteworthy part of our program is in the InteractionFrameReady method. This is where we process information about our users, route our UI events, handle things like Grip and GripRelease, etc.
Project Information URL: http://blogs.msdn.com/b/k4wdev/archive/2013/05/01/using-kinect-interactionstream-outside-of-wpf.aspx
Project Source URL: sample code