PXCSenseManager *pSenseMgr = new PXCSenseManager::CreateInstance(); if( !pSenseMgr ) { < continue on to creating the modes > }
PXCHandModule *pHandModule; PXCHandData *pHandData; int confidence; . . . < > . . . pxcStatus status; if( !pSenseMgr ) { status = pSenseMgr->EnableHand() if(status == pxcStatus::PXC_STATUS_NO_ERROR) { // Get an instance of PXCHandModule handModule = pSenseMgr->QueryHand(); // Get an instance of PXCHandConfiguration PXCHandConfiguration handConfig = handModule handConfig->EnableGesture("cursor_click"); handConfig->ApplyChanges(); . . . < > . . . } }
PXCHandCursorModule *pCursorModule; PXCCursorData::BodySideType bodySide; // , Confidence . . . < > . . . pxcStatus status; if( !pSenseMgr ) { // Enable handcursor tracking status = pSenseMgr::EnableHandCursor(); if(status == pxcStatus.PXC_STATUS_NO_ERROR) { // Get an instance of PXCCursorModule pCursorModule = pSenseMgr->QueryHandCursor(); // Get an instance of the cursor configuration PXCCursorConfiguration *pCursorConfig = CursorModule::CreateActiveConfiguration(); // Make configuration changes and apply them pCursorConfig.EnableEngagement(true); pCursorConfig.EnableAllGestures(); pCursorConfig.ApplyChanges(); . . . < > . . . } }
class MyHandler: public PXCSenseManager::Handler { public: virtual pxcStatus PXCAPI OnModuleProcessedFrame(pxcUID mid, PXCBase *module, PXCCapture::Sample *sample) { // check if the callback is from the hand cursor tracking module if (mid==PXCHandCursorModule::CUID) { PXCHandCursorModule *cursorModule=module->QueryInstance<PXCHandCursorModule>(); PXCCursorData *cursorData = cursorModule->CreateOutput(); // process cursor tracking data } // return NO_ERROR to continue, or any error to abort return PXC_STATUS_NO_ERROR; } }; . . . < SenseManager> . . . // Initialize and stream data MyHandler handler; // Instantiate the handler object // Register the handler object pSenseMgr->Init(&handler); // Initiate SenseManager's processing loop in blocking mode // (function exits only when processing ends) pSenseMgr ->StreamFrames(true); // Release SenseManager resources pSenseMgr ->Release()
Source: https://habr.com/ru/post/306010/
All Articles