Using Two Kinect at the same time RRS feed

  • Question

  • Hello

    I would like to acquire image stream from two Kinect devices at the same time, however there is a problem.  Initialization of a second Kinect fails. Here is a simple code that shows the problem:

    // Bug_report.cpp : Defines the entry point for the console application.
    #pragma once
    #include "stdafx.h"
    #include "windows.h"
    #include "MSR_NuiApi.h"
    int _tmain(int argc, _TCHAR* argv[])
    	printf("Connecting to Kinetics ...\n");
    	HRESULT hr, hr0, hr1, hr_init_0, hr_init_1;
    	int no_kinetics;
    	hr = MSR_NUIGetDeviceCount(&no_kinetics);
    	printf(" %d Kinetics found \n\n", no_kinetics);
    	if (no_kinetics != 2) {
    		printf ("Two kinetics are needed for this test! Aborting ...\n");
    		return -1 ;
    	INuiInstance*  kinect_0=NULL;  
    	hr_init_0 = MSR_NuiCreateInstanceByIndex(0, &kinect_0);
    	if (hr_init_0 == S_OK) {
    		printf("Created Kinetic instance 0, pointer addres:  %p \n",kinect_0);
    	else {
    		printf("Creation of Kinetic instance 0 FAILED. \n");
    	hr0 = kinect_0->NuiInitialize(NUI_INITIALIZE_FLAG_USES_SKELETON);
    	if (hr0 == S_OK) {	
    		printf("Initialization of Kinect 0 was successful\n");
    	else {
    		printf("Initialization of kinetic 0 failed ! Return code was %d\n",(int)hr0);
    		//return -3;
    	INuiInstance*  kinect_1=NULL; 
    	hr_init_1 = MSR_NuiCreateInstanceByIndex(1, &kinect_1);
    	printf("Created Kinetic instance 1, pointer addres:  %p \n",kinect_1);
    	hr1 = kinect_1->NuiInitialize(NUI_INITIALIZE_FLAG_USES_SKELETON); 
    	if (hr1 == S_OK) {	
    		printf("Initialization of Kinect 1 was successful\n");
    	else {
    		printf("Initialization of kinetic 1 failed ! Return code was %d\n",(int)hr1);
    		//return -3;
    	return 0;

    Result is here:

    Connecting to Kinetics ...
     2 Kinetics found

    Created Kinetic instance 0, pointer addres:  00C9BA70
    Attempting to open \\?\usb#vid_045e&pid_02ae#a00363a17920046a#{00873fdf-61a8-11d
    KinWinDeviceName = (\\?\usb#vid_045e&pid_02ae#a00363a17920046a#{00873fdf-61a8-11
    KinectCamera_OpenStreamEndpoint Opened successfully.
    Initialization of Kinect 0 was successful

    Created Kinetic instance 1, pointer addres:  0043B708
    Initialization of kinetic 1 failed ! Return code was -2097086294
    Press any key to continue . . .


    If the order is changed, so that kinect 1 is initialized at first and kinect 0 second, then initialization of kinect 0 fails.

    It seems that only one kinect can be initalized at any given time, or am I missing something ?

    Is this a feature or a bug ?

    Tuesday, January 3, 2012 1:18 PM

All replies

  • Hi, You can use multiple Kinect to capture  Image Stream Same time.

    However, your initialization is  second Kinect is failing because the reason could be  both of your Kinect device connected in a single USB Controller.   Kinect devices might not work reliably when they are connected to the same USB host controller .

    While developing application using multiple Kinect, make sure devices are connected with different USB Controller and  both are plugged in with external power.

    Just Checkout the answer in one of the forum post,


    Here is a sample application developed using multiple kinect device


    Hope this will helps !




    • Proposed as answer by Abhijit Jana Tuesday, January 3, 2012 1:50 PM
    Tuesday, January 3, 2012 1:48 PM
  • I think the real problem is that we can only obtain video, depth and audio streams from multiple Kinects connected to the same machine. Skeleton frame has not yet been supported under this set up. 

    Hence, DO NOT USE NUI_INITIALIZE_FLAG_USES_SKELETON flag to init multiple NUI instances.

    Hope this can help you all.


    Wednesday, January 11, 2012 8:27 AM
  • Richard, is it possible to just detect a user on a certain kinect then reinitialise it temporarily to track said skeleton walking through it?

    I want to use multiple kinects for skeleton tracking, but it sounds like I might need to kludge it if this is the case.


    I wonder if the next SDK will allow this.

    Friday, January 13, 2012 2:08 AM
  •  I ask for merging depth images from multiple kinects at same time, my question how does merge more than one depth from multiple kinects to produce one depth image? Are you using some algorithm or what?
    if you can send the code?

    Wednesday, March 27, 2013 2:09 PM