Detect the Kinect V2 Devices

Typically, each camera or image device in the Image Acquisition Toolbox™ has one DeviceID. Because the Kinect® for Windows® camera has two separate sensors, the color sensor and the depth sensor, the toolbox lists two DeviceIDs. Use imaqhwinfo on the adaptor to display the two device IDs.

info = imaqhwinfo('kinect');
info

info = 
 
       AdaptorDllName: '<matlabroot>\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 as DeviceIDs [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 have Kinect Color Sensor with DeviceID 1 and Kinect Depth Sensor with DeviceID 2 and the second Kinect device would have Kinect V2 Color Sensor with DeviceID 3 and Kinect V2 Depth Sensor with DeviceID 4.

Note

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