Using Nite 2 in a Qt 5 project

478 views Asked by At

I'm trying to make a Kinect skeleton tracker using Nite 2 in a Qt 5 project using Visual Studio 2012. I included all the necessary folders in the project's properties. Qt is working fine, but the initialization call to Nite always returns STATUS_ERROR. I tried initializing Nite in a non-Qt program and it worked fine, so the problem seems linked to Qt. I was able to initialize OpenNI in a Qt project.

// main.cpp
int main(int argc, char* argv[])
{
    QApplication app(argc, argv);

    KinectWindow a;
    a.show();

    return app.exec();
}

// KinectWindow constructor
KinectWindow::KinectWindow(void)
    : QWidget()
{
    nite::Status status;

    status = nite::NiTE::initialize();

    if (status == nite::STATUS_ERROR)
    {
        exit(0);
    }

    else if (status == nite::STATUS_BAD_USER_ID)
    {
        exit(0);
    }

    else if (status == nite::STATUS_OUT_OF_FLOW)
    {
        exit(0);
    }
}

The program always enters if(status == nite::STATUS_ERROR). I tried copying the contents of the REDIST directory to the project folder, but it didn't help.

1

There are 1 answers

0
user3148225 On BEST ANSWER

The problem is that Qt 5 doesn't work with NiTE at the moment, but Qt 4 does. Using Qt 4.8.5 (in Visual Studio 2010) works fine. Just be aware that Qt 4 is only 32 bit, so you need to use the 32 bit versions of OpenNI and NiTE.