How to check if Kinect data streams are already enabled ?

You can capture the Kinect sensor image data stream either in format of color or depth data. Both the data streams can be capture in parallel as the data is being captured in two different channel.  Sensor start sending the data only when the stream channels are enabled and sensor is running.   You can check the stream channel  if they are already enabled before you re-enabling them by using “IsEnabled” property of stream channel.

For an example,  you can use following code snippet before you enable the depth data stream

KinectSensor sensor;
if (!sensor.DepthStream.IsEnabled)
{
sensor.DepthStream.Enable();
}

KinectSensor class has a property DepthStream of type DepthImageStream. This class also includes the IsEnabled property which return the current status of the depth stream channel. Don’t think you can set the values of this property to true or false, remember, this is a read-only property. Similar to DepthStreamImage, you can use the same for the ColorImageStream channel.

KinectSensor sensor;
if (!sensor.ColorStream.IsEnabled)
{
sensor.ColorStream.Enable();
}
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 check if Kinect data streams are already enabled ?”

Comments are closed.