Using the InteractionStream without WPF

Sign in to queue

Description

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...

Using Kinect InteractionStream Outside of WPF

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:

image

There are a few things to note here:

  1. Upon starting the program, we initialize our sensor, interactions, and create FrameReady event handlers.
  2. Our sensor is generating data for every frame.  We use our FrameReady event handlers to respond and handle depth, skeleton, and interaction frames.
  3. 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:
    ...
     
  4. 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: https://blogs.msdn.com/b/k4wdev/archive/2013/05/01/using-kinect-interactionstream-outside-of-wpf.aspx

Project Source URL: sample code

Contact Information:

The Discussion

  • User profile image
    Benjamin

    Thank you for this. this has finally answered many questions I had about this particular subject. I am however trying to convert it to VB.Net and am having some issues. Vb doesn't like declaring things "inline"

    I have you code working great in CS however it would be amazing if there was a more concrete example in vb.net. Is there anyway this is possible?

Add Your 2 Cents