none
How to run two parallel applications with one Kinect for each application on the same computer? RRS feed

  • Question

  • The main reason to do so, is that I want to grab skeleton tracking data from both of the Kinects, while only use one computer.

    The problem is, I am having Kinect A and Kinect B connecting to the same computer, and I am planning to run two c++ applications to get skeletons from both of the Kinects. However, I don't know how to choose Kinect A for C++ Application A, and Kinect B for C++ Application B...

    If I create a runtime for each sensor, then the kinect with index not equal to 0 will not be able to get the skeleton data. I guess, if I could defined both Kinects with index 0 for each of the appliation, I could solve the problem I am facing. But I am not sure if this is the way to go and how to do that.

    We are really stucked on this, any suggestion is welcomed. Thank you very much ahead.


    Lining YAO

    Sunday, February 12, 2012 11:18 PM

Answers

  • You can do this using the Kinect for Windows SDK, without hacking.

    rcitaliano is correct that yhou need to plug each kinect device into a different USB controller, each Kinect consumes more than 50% of the bandwidth.

    Then you should use the NuiCreateSensorByIndex() API.  That allows you to create a runtime for a particular sensor.  One app should request one Kinect, the other app should request the other Kinect.

    Within a particular application, you can only spin up Skeletal Tracking on one Kinect.  But with 2 applications (technically 2 processes) then you can have ST going on both.  For extra credit, you can use interprocess communication to send back ST data to one of the applications - this has been done successfully.

    For an example, check out the SkeletalViewer C++ sample code and the walk through in the How To guide.

    Tuesday, February 14, 2012 1:57 AM

All replies

  • hi Lizziey

    check this thread that talks about the USB controllers.

    you need to plug each kinect device on a different USB controller

     
    Monday, February 13, 2012 3:08 PM
  • My suggestion would be use OpenNI since that's significantly outside the scope of this SDK. OpenNI is architected much differantly, it's done as a pipeline. You assemble a pipeline by connecting sources to consumers. So a depth stream feeds segmentation which, in turn, feeds skeleton tracking. It's much more adaptable. It also supports a server so multiple applications can use a single Kinect. That server can feed over a network so you can have an application on one computer using sensors on multiple computers. It also has support for establishing the position of multiple sensors relative to one another when they overlapping fields so you can transform between their spaces.

    I would certainly do that as, at least, a proof of concept before trying to hack the Kinect SDK to do it.

    Monday, February 13, 2012 4:50 PM
  • You can do this using the Kinect for Windows SDK, without hacking.

    rcitaliano is correct that yhou need to plug each kinect device into a different USB controller, each Kinect consumes more than 50% of the bandwidth.

    Then you should use the NuiCreateSensorByIndex() API.  That allows you to create a runtime for a particular sensor.  One app should request one Kinect, the other app should request the other Kinect.

    Within a particular application, you can only spin up Skeletal Tracking on one Kinect.  But with 2 applications (technically 2 processes) then you can have ST going on both.  For extra credit, you can use interprocess communication to send back ST data to one of the applications - this has been done successfully.

    For an example, check out the SkeletalViewer C++ sample code and the walk through in the How To guide.

    Tuesday, February 14, 2012 1:57 AM
  • I meant by hacking jumping through hoops to get it to do what it wasn't intended to do. The idea is to avoid building a nice robust server only to find the whole idea is a bad one. OpenNI has a server. OpenNI apps have configuration files so you can configure an application to use the server rather than going directly against the sensor. That might pop on a light bulb about potential problems with commercial apps if you hold the sensor 24/7. They aren't going to use your server.

    Tuesday, February 14, 2012 11:01 PM
  • I used the openni faast and its not as smooth as kinect mouse usage so i dont know what thats about Budywizer especially with beta 2 which is way beta then beta 1 was but kinect for windows runtime and other things i dont know about its limitations or bugs yet.

    I find that using kinect sdk is better because open ni is not for beginners programming wise compared to kinect sdk and you can still using kinect sdk recognize people from more then one kinect but if their was a way to lock kinect one in first process then you could use process information of second process to identify second kinect attached to second process correctly and perform passive tracking which will involve depth data.

    You need to do passive tracking with depth data in order to track the people on second kinect if thats available but i wonder if it is especially since hes using a second process he coud lock first kinect into first process then use second kinect on second process if allowed using sdk.


    Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering - Yoda


    • Edited by The Thinker Wednesday, February 15, 2012 8:09 PM
    Wednesday, February 15, 2012 8:07 PM
  • Hey,

    Thank you very much for your suggestion. I did try your method. With two PCI cards connecting two kinects, it works perfectly. But when I add the 3rd PCI card, and try to run the 3rd application with the 3rd Kinect, it crashed. I printed out the number of Kinects, it said 3; but then, I got this error:

    Unhandled exception at 0x76f822b2 in KinectSDKandOF.exe: 0xC0000005: Access violation writing location 0x000000fc.

    My desktop is 3 years old, and cpu was used as 100% without running the 3rd applications. Maybe that is the problem?

    I was using old skd (beta 2) with Kinect for Xbox.

    Any suggestions/guess will be very much appreciated.


    Lining YAO

    Sunday, March 4, 2012 11:04 PM
  • hey bobheddle,

    Here's a question about using NuiCreateSensorByIndex() API and create a runtime for a particular sensor, when I run multiple (3) applications with 3 Kinects.

    After a night, I think in addition to the question that I am asking, I got a new question:if want to get skeleton tracking on each kinect, then I need to assign index 0 to all the 3 Kinects, as the kinect sdk can only do skeleton tracking with the Kinect at index 0.

    Then, how can that happen? Is it right that I just do the following in each application?

        INuiInstance* myInstance;
        MSR_NuiCreateInstanceByIndex(0,&myInstance);

    If so, will the 2nd and 3rd application I run automatically detect the Kinect that is not being used, and assign that Kinect to index 0 in it's own process?

    Thank you very much ahead. I will wait for any suggestions/guess.


    Lining YAO

    Monday, March 5, 2012 3:37 PM
  • Lizziey-

    We no longer have the limitation to only allow ST to work with the 0th Kinect. Only one Kinect can drive ST per process, but it could be any of the connected Kinects...not just the 0th.

    Does that help?

    Thanks, Rob

    Rob Relyea | http://twitter.com/rrelyea
    Kinect for Windows team | http://twitter.com/kinectwindows | http://kinectforwindows.com

    Monday, March 5, 2012 4:26 PM