When you are developing a Kinect application, you must ensure that the Kinect device attached with your application supports all the required capabilities. If the attached device does not support the capabilities that your application need, you can prompt a message to user on the same. Now, how do we identify the capabilities of Kinect sensor? Kinect for Windows SDK has a Properties KinectCapabilities
that returns the capabilities of the attached Kinect Sensor.
Following code snippet shows how to get the default connected sensor and the capabilities that the sensor supports.
KinectSensor sensor = KinectSensor.GetDefault(); if (sensor != null) { KinectCapabilities sensorCapabilities = sensor.KinectCapabilities; }
Run the above code and put a breakpoint to check the sensorCapabilities
.
KinectCapabilities
is a Flag enum defined in Microsoft.Kinect
assembly and having following list of items.
[Flags] public enum KinectCapabilities { // Summary: // No capabilities. None = 0, // // Summary: // Vision processing. Vision = 1, // // Summary: // Audio processing. Audio = 2, // // Summary: // Face processing. Face = 4, // // Summary: // Expression processing. Expressions = 8, // // Summary: // Game chat processing. Gamechat = 16, }
KinectSensor.KinectCapabilities
is a readonly property, that checks your device and return the Flags that are supported by the sensor.
Once it returns, you can check for required capabilities with below snippet.
if (sensorCapabilities.HasFlag(KinectCapabilities.Expressions)) { // Do something with expression }
Here is the full code snippet.
KinectSensor sensor = KinectSensor.GetDefault(); if (sensor != null) { KinectCapabilities sensorCapabilities = sensor.KinectCapabilities; if (sensorCapabilities.HasFlag(KinectCapabilities.Expressions)) { // Do something with expression } }
Hope this helps.
Pingback: Dew Drop – February 9, 2015 (#1950) | Morning Dew