Gesture recognition with Qt RRS feed

  • Question

  • Hello everybody,

    for about a month I'm using the Kinect v2 together with the Qt-Framework (C++). Everything works perfectly fine, except the gesture recognition. I can load gestures from a *.gba or *.gbd file and they are valid (as I checked by calling the possible functions). Registering a source and reader works as well as getting the gestureResult-object. But (for discrete objects) the confidence is always 0 and the gesture is not detected (false). I checked it with the "Live preview"-program from the VGB running at the same time, using the same *.gba file, there it works.

    Attachted you find the relevant code part (only a snippet, as the whole source code would be too long). 

    IVisualGestureBuilderFrameSource* source = 0; //this->kinectSensor() returns the active and running kinect sensor //bodyIndex is the tracking id of the body CreateVisualGestureBuilderFrameSource(this->kinectSensor(), bodyIndex, &source); //gestures is a QList of IGesture* loaded from a file foreach(IGesture* gesture, gestures) { source->AddGesture(gesture); source->SetIsEnabled(gesture, true); }

    //result is a null pointer of type IVisualGestureFrameReader source->OpenReader(&result); WAITABLE_HANDLE arrived; result->SubscribeFrameArrived(&arrived); //WinEventNotifier: Modified version of QWinEventNotifier - Makes it possible to use Kinect SDK with the Qt event loop WinEventNotifier* notifier = new WinEventNotifier(reinterpret_cast<HANDLE>(arrived)); //Connect the notifier with a lambda function connect(notifier, &WinEventNotifier::customActivated, [this, arrived, bodyIndex, result, gestures] () { IVisualGestureBuilderFrame* frame = 0; HRESULT h = result->CalculateAndAcquireLatestFrame(&frame); if(SUCCEEDED(h)) { BOOLEAN validTrackingId = false; h = frame->get_IsTrackingIdValid(&validTrackingId); if(SUCCEEDED(h) && validTrackingId) { IDiscreteGestureResult* gestureResult = 0; h = frame->get_DiscreteGestureResult(, &gestureResult); if(SUCCEEDED(h) && (gestureResult != 0)) { float confidence = -1; gestureResult->get_Confidence(&confidence); //Output the confidence (always 0) qDebug() << confidence; SafeRelease(gestureResult); } } SafeRelease(frame); } //Fire event and reset the handle ResetEvent(reinterpret_cast<HANDLE>(arrived)); emit(visualGestureFrameArrived(bodyIndex)); }); //Release source SafeRelease(source);

    I'm thankful for any suggestions how to solve the problem or what I might be missing!

    If you need further information, do not hestitate to ask!

    Thank you!

    • Edited by LBX90 Wednesday, May 13, 2015 4:32 PM Added comments to source code.
    Wednesday, May 13, 2015 4:29 PM