|Multi-touch with Kinect and WPF 4|
The update comes with two simple WPF samples in a new Candescent NUI WPF Samples project.
It also works with the WPF samples of Microsoft Surface 2.0 SDK, but you'll have to add the KinectTouchDevice for each demo project manually.
Screen capture of the multi-touch sample project
All fingers of both hands can be used simultaneously. Though it rarely makes sense to use more than 1 or two per hand.
Please note: I've only published the source code, I'll add a binary release soon. The sample only runs with OpenNI for the moment.
The class CCT.NUI.Touch.KinectMultiTouchDevice can be found in the CCT.NUI.HandTracking.dll.
In a WPF 4 window it can be initialized like this (in the loaded event, you must should not add this code in the constructor).
this.factory = new OpenNIDataSourceFactory("config.xml"); var handDataSource = new HandDataSource(this.factory.CreateClusterDataSource()); this.multiTouchDevice = new KinectMultiTouchDevice(handDataSource, this); handDataSource.Start();
The device identifiers are created the following way: The ID is always a 2 digit decimal number where the first number is the hand ID and the second number the finger ID. Finger IDs are assigned in order of appearance and do not identify a specific finger (for example index).
There are some glitches here and there, I'll keep working on it. For now I'm looking forward to see what you'll do with it!
Other changes in changeset 9161
- New mapping algorithm
Hands and fingers are mapped between two frames and keep the same ID until they disappear. IDs are reused! That means if Hand 1 is removed from view the next hand that appears will get ID 1 again. The same is true for the fingers.
- Fingers and Hands implement the ILocatable interface
- HandData.Id is now int instead of guid
- Finger points get IDs. They are assigned in order of appearance, so you can't assume that 1 is always the thumb. Also the IDs are reused.
- Option to show depth view in Candescent StartMenu
- Exit button in Candescent Start Menu