Today it’s time to explore the Kinect for Windows device. In fact the Kinect is a bunch of sensors that you can read. It has a color camera, an infrared camera, an infrared projector and a microphone array. I set my goal to develop an applications that is able to interact with the Microsoft Lync client.
The first thing to do is determining wether there is a sensor connected and if: then start the sensor. If not: display a text with the status and display an image. All works fine, except when plugging and unplugging the device. Then the sensor get a sensorstatus: InsufficientBandwidth
In case someone unplugged of plugged the sensor after starting the program, I created an eventhandler for KinectSensor.KinectSensors.StatusChanged and if this event happened I run StartKinect.
My code is as follows:
Of course my USB hub is not heavily used and is USB 2.0, so there should be enough bandwidth. So what was going on?
After unplugging the Kinect for Windows sensor the KinectSensor instance KinectSensorInUse was not disposed off. When reconnecting the Kinect the instance gives apperantly the wrong status to the instance. After modifying the code so that the instance is disposed of after unplugging all worked very well.