Today's project is another in András Velvárt series on using the new Kinect Interactions. In this project he's making it even easier with...
Kinect Interaction with WPF Part II: Getting Started Easier [KinectChooserEx]
In the previous post of this series, I have introduced the Kinect for Windows SDK 1.7, and the key controls and concepts within its Kinect Interactions toolkit. If you have followed through that post, you have seen all the work and code you need to get the basics running. Most of the initialization code was biolerplate, and code that you can easily copy and paste into your own project.
I have packaged up the initialization code into a UserControl called KinectChooserEx, and wired up a couple of dependency properties.
Note: I could have inherited from KinectChooser instead of packaging it into a user control. But I ran into some serious strong name issues, and wanted more consistent naming for the properties, so it was better to hide some internal workings.
The NearMode property is a boolean value, and can be used to turn Near Mode on and off. Changing Near Mode also sets the EnableTrackingInNearRange of the SkeletonStream. You will probably want to keep NearMode as false if you are using a Kinect for XBox sensor instead of a Kinect for Windows one. Otherwise the interaction engine works better at close range, so I have set NearMode to be true by default.
The other property is KinectSensor, which contains null if no sensor is initialized, or a KinectSensor object if one is.
Both of these properties are bindable. With KinectChooserEx, you can finally get started with your own Kinect project purely in Blend, without writing a single line of code (at least for the interaction part). Here is a step by step tutorial on how to do this:
Create a New Project and Add KinectChooserEx.xaml and KinectChooserEx.xaml.cs
Create a new WPF project, and add the necessary references as described in my previous post. Drag and drop the KinectChooserEx.xaml and KinectChooserEx.xaml.cs files from Explorer into the project. You will also want to add the KinectInteraction170_32.dll and KinectInteraction170_64.dll files at this point (again, see my previous post).
- Add KinectChooserEx to the MainPage
- Adding a KinectRegion
- Adding a KinectUserViewer control
- Let’s See it Work!
- Using the Near Mode
Project Download URL: http://sdrv.ms/117qGxo
Project Source URL: http://sdrv.ms/117qGxo