Main Content

Detect the Kinect V2 Devices

Typically, each camera or image device in the Image Acquisition Toolbox™ has oneDeviceID. Because the Kinect®for Windows®camera has two separate sensors, the color sensor and the depth sensor, the toolbox lists twoDeviceIDs. Useimaqhwinfoon the adaptor to display the two device IDs.

info = imaqhwinfo('kinect'); info info = AdaptorDllName: '\toolbox\imaq\supportpackages\kinectruntime\adaptor \win64\mwkinectimaq.dll' AdaptorDllVersion: '5.0 (R2016a)' AdaptorName: 'kinect' DeviceIDs: {[1] [2]} DeviceInfo: [1x2 struct]

If you look at each device, you can see that they represent the color sensor and the depth sensor. The following shows the color sensor.

info.DeviceInfo(1) ans = DefaultFormat: 'RGB_1920x1080' DeviceFileSupported: 0 DeviceName: 'Kinect V2 Color Sensor' DeviceID: 1 VideoInputConstructor: 'videoinput('kinect', 1)' VideoDeviceConstructor: 'imaq.VideoDevice('kinect', 1)' SupportedFormats: 'RGB_1920x1080'

The following shows the depth sensor, which is Device 2.

info.DeviceInfo(2) ans = DefaultFormat: 'Depth_512x424' DeviceFileSupported: 0 DeviceName: 'Kinect V2 Depth Sensor' DeviceID: 2 VideoInputConstructor: 'videoinput('kinect', 2)' VideoDeviceConstructor: 'imaq.VideoDevice('kinect', 2)' SupportedFormats: 'Depth_512x424'

You can use multiple Kinect devices together, but only one Kinect V2 at a time. Multiple Kinect sensors are enumerated asDeviceIDs[1] [2] [3] [4]and so on. For example, if you had two Kinect devices, a Kinect V1 and a Kinect V2, the first one would haveKinect Color SensorwithDeviceID 1andKinect Depth SensorwithDeviceID 2and the second Kinect device would haveKinect V2 Color SensorwithDeviceID 3andKinect V2 Depth SensorwithDeviceID 4.

Note

For more information on the Kinect streams, seeData Streams Returned by the Kinect V2 Adaptor in MATLAB. For an example showing how to acquire color images and body metadata, seeAcquire Image and Body Data Using Kinect V2.