private void UpdateConfiguration() { pxcmStatus rc; PXCMTouchlessController.ProfileInfo pInfo; rc = ptc.QueryProfile(out pInfo); Console.WriteLine("Querying Profile: " + rc.ToString()); if (rc != pxcmStatus.PXCM_STATUS_NO_ERROR) { Environment.Exit(-1); } pInfo.config = PXCMTouchlessController.ProfileInfo.Configuration.Configuration_Scroll_Vertically; rc = ptc.SetProfile(pInfo); Console.WriteLine("Setting Profile: " + rc.ToString()); }
public void SetConfiguration(PXCMTouchlessController.ProfileInfo.Configuration configuration) { PXCMTouchlessController.ProfileInfo pInfo; pxcmStatus res = m_touchlessController.ClearAllGestureActionMappings(); if (res != pxcmStatus.PXCM_STATUS_NO_ERROR) { throw new RealSenseEngineException("Failed to Clear All Gesture Action Mappings. {0}", res); } res = m_touchlessController.QueryProfile(out pInfo); if (res != pxcmStatus.PXCM_STATUS_NO_ERROR) { throw new RealSenseEngineException("Failed to Query Profile. {0}", res); } pInfo.config = configuration; res = m_touchlessController.SetProfile(pInfo); if (res != pxcmStatus.PXCM_STATUS_NO_ERROR) { throw new RealSenseEngineException("Failed to Set Profile. {0}", res); } }
// RS private void STButton_Click(object sender, RoutedEventArgs e) { EXButton.IsEnabled = true; STButton.IsEnabled = false; // init the sense manager _senseManager = PXCMSenseManager.CreateInstance(); // enable hand analysis in the multimodal pipeline _senseManager.EnableTouchlessController(); // init the pipeline if (_senseManager.Init() < pxcmStatus.PXCM_STATUS_NO_ERROR) { MessageBox.Show("RealSense Camera init failed"); } // get an instance of the touchless control _touchlessController = _senseManager.QueryTouchlessController(); // register fo ux event _touchlessController.SubscribeEvent(OnTouchlessControllerUXEventHandler); //event _touchlessController.SubscribeAlert(OnFiredAlertEventHandler); //alert // configuration pxcmStatus rc; PXCMTouchlessController.ProfileInfo pInfo; rc = _touchlessController.QueryProfile(out pInfo); pInfo.config = PXCMTouchlessController.ProfileInfo.Configuration.Configuration_Allow_Zoom | PXCMTouchlessController.ProfileInfo.Configuration.Configuration_Allow_Selection | PXCMTouchlessController.ProfileInfo.Configuration.Configuration_Allow_Back; rc = _touchlessController.SetProfile(pInfo); // configure hand module _hand = _senseManager.QueryHand(); _handConfig = _hand.CreateActiveConfiguration(); _handConfig.EnableGesture("thumb_up", true); // true is importment _handConfig.EnableGesture("v_sign", true); _handConfig.SubscribeGesture(OnFiredGestureEventHandler); _handConfig.ApplyChanges(); // processing loop _processingThread = new Thread(new ThreadStart(ProcessingThread)); _processingThread.Start(); }