How to Identify the Kinect Sensor Capabilities ?

How to Identify the Kinect Sensor Capabilities ?

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 KinectCapabilitiesthat 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

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.

Abhijit Jana

Abhijit runs the Daily .NET Tips. He started this site with a vision to have a single knowledge base of .NET tips and tricks and share post that can quickly help any developers . He is a Former Microsoft ASP.NET MVP, CodeProject MVP, Mentor, Speaker, Author, Technology Evangelist and presently working as a .NET Consultant. He blogs at http://abhijitjana.net , you can follow him @AbhijitJana . He is the author of book Kinect for Windows SDK Programming Guide.

One Comment to “How to Identify the Kinect Sensor Capabilities ?”

Comments are closed.