Esempio n. 1
0
        private void StartRealSense()
        {
            bool useHead = bool.Parse(ConfigurationManager.AppSettings["UseHead"]);

            // Instantiate and initialize the SenseManager
            senseManager = PXCMSenseManager.CreateInstance();

            // Configure the Hand Module
            if (useHead)
            {
                senseManager.EnableFace();

                face       = senseManager.QueryFace();
                faceConfig = face.CreateActiveConfiguration();
                faceConfig.detection.isEnabled = true;
                faceConfig.QueryExpressions().Enable();

                faceConfig.ApplyChanges();
            }
            else
            {
                // Enable cursor tracking
                senseManager.EnableHand();

                // Get an instance of the hand cursor module
                hand = senseManager.QueryHand();

                // Get an instance of the cursor configuration
                var cursorConfig = hand.CreateActiveConfiguration();

                // Make configuration changes and apply them
                cursorConfig.DisableAllAlerts();
                cursorConfig.EnableTrackedJoints(true);
                cursorConfig.EnableStabilizer(true);
                cursorConfig.ApplyChanges();
            }

            senseManager.Init();

            // Create an instance of PXCMSmoother
            senseManager.session.CreateImpl <PXCMSmoother>(out smoother);
            smoother2D  = smoother.Create2DQuadratic(.5F);
            smoother2D2 = smoother.Create2DQuadratic(1);

            // Start the worker thread
            processingThread = new Thread(new ThreadStart(ProcessingThread));
            processingThread.Start();
        }
Esempio n. 2
0
    private void CreateSmootherType(SmoothingTypes type, float factor, out PXCMSmoother.Smoother2D smoother)
    {
        switch (type)
        {
        case SmoothingTypes.Quadratic:
            smoother = _smoother.Create2DQuadratic(factor);
            break;

        case SmoothingTypes.Stabilizer:
            smoother = _smoother.Create2DStabilizer(7, factor);
            break;

        case SmoothingTypes.Weighted:
            smoother = _smoother.Create2DWeighted((int)factor);
            break;

        case SmoothingTypes.Spring:
        default:
            smoother = _smoother.Create2DSpring(factor);
            break;
        }
    }