Using Kinect Instance Id to Initialize the Kinect Sensor

Every Kinect sensor can be uniquely identified by an instance id. You can track and initialize each device connected based on that instance id when multiple devices are connected to the system. This instance id  can be either the DeviceConnectionId or UniqueKinectId.

Kinect Sensor InstanceId

If you know the DeviceConnectionId for the particular Kinect sensor [ KinectSensor.DeviceConnectionId  returns this id], you can use the same for instantiating the senor instead of using index . This will make sure that you are initializing the correct device if there are multiple numbers of devices. In code snippet below we have used the previously received unique instance id

KinectSensor sensor = KinectSensor.KinectSensors [@" USUSB\VID_0409&PID_005A\6&35F09B95&0&3"];
sensor.Start()

The DeviceConnectionId  is the connection id returns the USB hub device instance path id, it may change once you plugged in the device in different USB controller Hub.

You can check by following –  Open “Control Panel” and navigate to “Device Manager”. Then change the view of device manager to “Device by Connection”. Select the “Generic USB Hub” for the “Kinect for Windows Device” node and open properties. There you will find the same id which was specified in the above code.

Kinect Device instacePath

KinectSensor object has another property named UniqueKinectId that returns a Unique Id for the Kinect sensor. You can use this Id to identify sensor uniquely.

KinectInstanceID

Shout it

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.