"Recovering Gracefully from Loss of Skeletal Tracking"
- Posted: May 11, 2012 at 6:00 AM
- 5,842 Views
Today's project is a sharing of lessons learned by Carl Franklin while creating his GesturePak project (GesturePak (Beta) for the Kinect - A "no code" gesture recording and matching library)
The Kinect For Windows SDK v1.0 is awesome, but it doesn't recover well when it loses sight of you whilst tracking your skeleton. With a timer control and a little code to restart the KinectSensor, you can recover is 5 seconds or less.
This is the same code I use in GesturePak, a gesture recording and recognition SDK for Kinect for Windows.
Create a new WPF application and add a reference to the Kinect SDK assembly:
C:\Program Files\Microsoft SDKs\Kinect\v1.0\Assemblies\Microsoft.Kinect.dll
You don't need any controls for this demo. It simply turns the form red when tracking, and white when not tracking.
The basic idea is that when we lose tracking for the first time, you kick off a timer to fire it's Tick event in 1/2 a second. In the timer Tick handler you stop the Kinect Sensor, Start it up again, and then set the timer's Interval to a more reasonable amount of time. I use 5 seconds, but you should test it in your app. If it's too short, you don't give the Kinect time to track you, and if it's too long and it doesn''t track you, you could be sitting and waiting too long. 5 seconds seems reasonable to me.
When the state changes from not tracking to tracking, you simply disable the timer.
Here's the code in both C# and VB.NET. In each case you can replace the default code behind MainWindow.xaml and run it. The C# app has to have a reference to System.Windows.Forms
...
Project Information URL: http://carlfranklin.net/blog/2012/4/30/recovering-gracefully-from-loss-of-skeletal-tracking-kinect.html
Contact Information:
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.
Follow the Discussion
Oops, something didn't work.
What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in. You need to be signed in to Channel 9 to use this feature.What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in and view them all on your notifications page.sign up for email notifications?