Unanswered Kinect hangs at NuiImageStreamOpen

  • Friday, May 11, 2012 8:18 AM
     
     

    Hello, I have a problem on Kinect SDK v1.0.

    [Problem and Question]

    My program hangs when I call NuiImageStreamOpen. Does somebody have an idea about what the problem is?

    [Source code which cause error (I intentionally excluded error handling logic)]

    HRESULT hr = NuiInitialize(NUI_INITIALIZE_FLAG_USES_DEPTH | NUI_INITIALIZE_FLAG_COLOR);

    HANDLE hColorEvent = CreateEvent(NULL, true, false, NULL);

    HANDLE hVideoStream = NULL;

    hr = NuiImageStreamOpen(NUI_IMAGE_TYPE_COLOR, NUI_IMAGE_RESOLUTION_640x480, NULL, 2, hColorEvent, &hVideoStream); // works fine

    HANDLE hDepthEvent = CreateEvent(NULL, true, false, NULL);

    HANDLE hDepthStream = NULL;

    hr = NuiImageStreamOpen(NUI_IMAGE_TYPE_DEPTH, NUI_IMAGE_RESOLUTION_640x480, NULL, 2, hDepthEvent, &hDepthStream); // hangs here

    NuiCameraElevationSetAngle(10); // never reach here due to NuiImageStreamOpen hang

    [Additional Information and my guess]

    Please note that above source code works fine by yesterday. I just start to see this problem from today.

    I have been using depth sensor all the day recently, so I guess it made the depth sensor defective and the cause of this hang.

    Unfortunately, I have only one Kinect, so I can't confirm if this is hardware problem or not.

    Any idea about how I can check if this is a hardware problem is also helpful.

    Thanks for your help and taking time to the question!

All Replies

  • Friday, May 11, 2012 5:45 PM
    Owner
     
     

    (I assume your NuiInitialize call actually passes NUI_INITIALIZE_FLAG_USES_COLOR and that the code above is just a typo.)

    Have you tried:

    • Disconnecting and reconnecting the Kinect sensor
    • Disconnecting and reconnecting its power supply
    • Rebooting the computer

    Also, I'm not sure whether this item from the release notes (http://www.microsoft.com/en-us/kinectforwindows/develop/release-notes.aspx#_6._known_issues) may apply:

    If C++ code is executing NuiInitializa/NuiShutdown multiple times through the application's lifetime, SetDeviceStatusCallback should be called once, before invoking those calls.

    John
    K4W Dev

  • Monday, May 14, 2012 12:31 AM
     
     

    Thanks for your reply and sorry for my typo.

    I tried things listed below, but nothing changed unfortunately.

    1. Disconnecting and reconnecting the Kinect
    2. Disconnecting and reconnecting the power supply
    3. Rebooting the computer
    4. Uninstall and re-install Kinect SDK

    I continue to check the problem and share when I get an update.

  • Monday, May 14, 2012 2:07 AM
     
     

    I finally found the solution, but I don't know why it solved the problem.

    1. Create new empty project on Visual Studio 2010.
    2. Copy source codes.
    3. Run

    I don't know why creating a new project solved the hang problem. I found "Skeletal Viewer" in Kinect Sample Browser worked, so this means my Kinect doesn't have a hardware problem. In addition, copying Kinect related source code from "Skeltal Viewer" to my project didn't work, so it made me come up with creating new project. Could be the bug on Visual Studio 2010....