Kinect / PyKinect2

Wrapper to expose Kinect for Windows v2 API in Python
MIT License
496 stars 236 forks source link

Track individual Handstates (Open,Closed or Lasso) #49

Closed avpai closed 6 years ago

avpai commented 6 years ago

Hi,

I have to going through the example codes and trying to figure out various stuffs. Is there anyway to track the state of the hand? I can see that it has variables- HandState_Lasso,HandState_Open , HandState_Closed,HandState_Unknown and HandState_NotTracked. But exactly do we use this to track each hands or both the hands together for that matter? In the C++ documentation I found out there is a small snippet:

       HandState leftHandState;
        hr = body->get_HandLeftState(&leftHandState);
        if (SUCCEEDED(hr)) 
       {
            if (leftHandState == HandState_Closed) {
                std::cout << "CLOSED HAND\n";
            }
            else if (leftHandState == HandState_Open) {
                std::cout << "OPEN HAND\n";
            }
            else if (leftHandState == HandState_Lasso) {
                std::cout << "PEW PEW HANDS\n";
            }
            else if (leftHandState == HandState_NotTracked) {
                std::cout << "HAND IS NOT TRACKED\n";
            }
            else if (leftHandState == HandState_Unknown) {
                std::cout << "HANDS STATE IS UNKNOWN\n";
            }
        }

Is there anything similar in Pykinect2? I found the C++ snippet online and haven't tried it out.

avpai commented 6 years ago

@vladkol , @benlower , any ideas/ suggestions,guys?