The KinectSensor
class has a property ColorStream
of type ColorImageStream
, which actually handles everything that is required for capturing the color image. The first thing it must do is get the reference of the connected sensor and start it.
this.sensor = KinectSensor.KinectSensors.FirstOrDefault( sensorItem => sensorItem.Status == KinectStatus.Connected); this.StartSensor();
Here sensor
is an object of the type KinectSensor
class. Once you have the sensor
object and reference of the Kinect sensor, you can enable the stream by calling the Enable()
method of the ColorImageStream
class, as follows:
this.sensor.ColorStream.Enable();
When the sensor is running and the color stream is enabled, it will initialize the Kinect sensor to generate a stream of color images.
The next thing you must do is to tell the sensor what to do when it has captured a new image frame. To achieve this, you need an event handler that has to be attached to the sensor stream channel...