none
Event notification when kinect hand is engaged / disengaged RRS feed

  • Question

  • I have only been working with this for a week or so, but I have the speech recognition and custom dictionary working wonderfully, so glad you used the same speech library that Lync does.  I am however stuck.  I would love to make a my application resize and show kinect size buttons when someone has engaged their hand, and then collapse that when they stop.  The program is I can't see to find anyway to register for the 2 events like handEngaged and handDisengaged.  I have looked through the samples, I do have a kinect region and the hand comes and goes as I would like, I just want to be notified when it comes and goes to make the app have a friendlier approach for input.

    I am sure this is probably easy and I am just missing something.  I've search the forum, but haven't really found what I need.  Any simple code sample reply would be much appreciated.

    Friday, September 12, 2014 6:21 PM

Answers

  • Do you really want to change the UI based on engagement? It may be that you want to show a UserViewer and larger controls if a user is far away from the screen.

    That said, if you do want to understand when a hand cursor is active, the following techniques will work:

    1) I've tested the following with WPF's Kinect Region.  (should also work with XAML's...let us know if it doesn't)

                var timer = new DispatcherTimer(new TimeSpan(0, 0, 0, 0, 33), DispatcherPriority.Normal, (sender, args) =>
                {
                    var engagedUserCount = kinectRegion.EngagedBodyTrackingIds.Count;
                    if (engagedUserCount > 0)
                    {
                        // you have one or more users engaged
                    }
                }, this.Dispatcher);

    2) Listen to KinectCoreWindow.PointerMoved. If the 0-12 events you get with the same timestamp have one or more PointerPointer.Properties.IsEngaged true, then you have an active cursor.

    Thanks, Rob

    http://twitter.com/rrelyea


    Rob Relyea [MSFT] http://twitter.com/rrelyea

    Monday, September 15, 2014 7:03 PM

All replies

  • Do you really want to change the UI based on engagement? It may be that you want to show a UserViewer and larger controls if a user is far away from the screen.

    That said, if you do want to understand when a hand cursor is active, the following techniques will work:

    1) I've tested the following with WPF's Kinect Region.  (should also work with XAML's...let us know if it doesn't)

                var timer = new DispatcherTimer(new TimeSpan(0, 0, 0, 0, 33), DispatcherPriority.Normal, (sender, args) =>
                {
                    var engagedUserCount = kinectRegion.EngagedBodyTrackingIds.Count;
                    if (engagedUserCount > 0)
                    {
                        // you have one or more users engaged
                    }
                }, this.Dispatcher);

    2) Listen to KinectCoreWindow.PointerMoved. If the 0-12 events you get with the same timestamp have one or more PointerPointer.Properties.IsEngaged true, then you have an active cursor.

    Thanks, Rob

    http://twitter.com/rrelyea


    Rob Relyea [MSFT] http://twitter.com/rrelyea

    Monday, September 15, 2014 7:03 PM
  • Thanks Rob, that is exactly what I needed.  Sorry for the confusion, there are apps, kinect apps, and this app is a "hybrid" that can use many forms of input, keyboard, mouse, kinect speech, kinect hand cursor, and gestures.  I'll post back a link when it's completely integrated and our 4k promo video is done.
    Tuesday, September 16, 2014 1:18 PM