Example #1
0
        public GestureHelper()
        {
            gestureController = new GestureController();
            gestureController.GestureRecognized += OnGestureRecognized;

            // register the gestures for this demo
            RegisterGestures();
        }
Example #2
0
        public GestureHelper()
        {
            gestureController = new GestureController();
            gestureController.GestureRecognized += OnGestureRecognized;

            // register the gestures for this demo
            RegisterGestures();
        }
        public GestureControllerHandler()
        {
            // initialize the gesture recognizer
            GestureController = new GestureController();
            GestureController.GestureRecognized += OnGestureRecognized;

            // add timer for clearing last detected gesture
            clearTimer = new Timer(2000);
            clearTimer.Elapsed += new ElapsedEventHandler(clearTimer_Elapsed);

            // register the gestures for this demo
            RegisterGestures();
        }
Example #4
0
        public void RegisterGestures(List<GestureType> gestureList)
        {
            if (gestureList.Contains(GestureType.JoinedHands) || gestureList.Contains(GestureType.LeftHandHalfLift) ||
                gestureList.Contains(GestureType.Pull) || gestureList.Contains(GestureType.Push) ||
                gestureList.Contains(GestureType.ZoomIn) || gestureList.Contains(GestureType.ZoomOut))
            {
                gestureController = new GestureController();
                gestureController.GestureRecognized += OnGestureRecognized;
                if (gestureList.Contains(GestureType.JoinedHands))
                {
                    IRelativeGestureSegment[] joinedhandsSegments = new IRelativeGestureSegment[15];
                    JoinedHandsSegment1 joinedhandsSegment = new JoinedHandsSegment1();
                    for (int i = 0; i < 15; i++)
                    {
                        // gestureType consists of the same thing 10 times
                        joinedhandsSegments[i] = joinedhandsSegment;
                    }
                    gestureController.AddGesture("JoinedHands", joinedhandsSegments);
                }
                if (gestureList.Contains(GestureType.LeftHandHalfLift))
                {
                    IRelativeGestureSegment[] menuSegments = new IRelativeGestureSegment[15];
                    MenuSegment1 menuSegment = new MenuSegment1();
                    for (int i = 0; i < 15; i++)
                    {
                        // gestureType consists of the same thing 20 times
                        menuSegments[i] = menuSegment;
                    }
                    gestureController.AddGesture("Menu", menuSegments);
                }
                if (gestureList.Contains(GestureType.Pull))
                {
                    IRelativeGestureSegment[] pullLeftSegment = new IRelativeGestureSegment[2];
                    pullLeftSegment[0] = new PullAndPush6();
                    pullLeftSegment[1] = new PullAndPush7();
                    gestureController.AddGesture("PullLeft", pullLeftSegment);

                    IRelativeGestureSegment[] pullSegment = new IRelativeGestureSegment[2];
                    pullSegment[0] = new PullAndPush3();
                    pullSegment[1] = new PullAndPush4();
                    gestureController.AddGesture("Pull", pullSegment);
                }
                if (gestureList.Contains(GestureType.Push))
                {
                    IRelativeGestureSegment[] pushLeftSegment = new IRelativeGestureSegment[2];
                    pushLeftSegment[0] = new PullAndPush8();
                    pushLeftSegment[1] = new PullAndPush6();
                    gestureController.AddGesture("PushLeft", pushLeftSegment);

                    IRelativeGestureSegment[] pushSegment = new IRelativeGestureSegment[2];
                    pushSegment[0] = new PullAndPush5();
                    pushSegment[1] = new PullAndPush3();
                    gestureController.AddGesture("Push", pushSegment);
                }
                if (gestureList.Contains(GestureType.ZoomIn))
                {
                    IRelativeGestureSegment[] zoomInSegments = new IRelativeGestureSegment[3];
                    zoomInSegments[0] = new ZoomSegment1();
                    zoomInSegments[1] = new ZoomSegment2();
                    zoomInSegments[2] = new ZoomSegment3();
                    gestureController.AddGesture("ZoomIn", zoomInSegments);
                }
                if (gestureList.Contains(GestureType.ZoomOut))
                {
                    IRelativeGestureSegment[] zoomOutSegments = new IRelativeGestureSegment[3];
                    zoomOutSegments[0] = new ZoomSegment3();
                    zoomOutSegments[1] = new ZoomSegment2();
                    zoomOutSegments[2] = new ZoomSegment1();
                    gestureController.AddGesture("ZoomOut", zoomOutSegments);
                }
            }

            if (gestureList.Contains(GestureType.SwipLeft)||gestureList.Contains(GestureType.SwipRight))
            {
               activeRecognizer  = new Recognizer();
                if (gestureList.Contains(GestureType.SwipLeft))
                {
                    activeRecognizer.SwipeLeftDetected += (s, e) =>
                    {
                        if (e.Skeleton.TrackingId == NearestId)
                        {
                            GestureDetected(this,GestureType.SwipLeft);
                        }
                    };
                }
                if (gestureList.Contains(GestureType.SwipRight))
                {
                    activeRecognizer.SwipeRightDetected += (s, e) =>
                    {
                        if (e.Skeleton.TrackingId == NearestId)
                        {
                            GestureDetected(this,GestureType.SwipRight);
                        }
                    };
                }
            }
        }
 public KinectSkelectionGestureNode()
 {
     gestureController = new GestureController();
     gestureController.GestureRecognized += OnGestureRecognized;
 }
Example #6
0
 public GesturesObserver()
 {
     _gestureController = new GestureController();
     _gestureController.GestureRecognized += OnGestureRecognized;
 }
Example #7
0
        private void InitializeKinectServices(KinectSensorManager kinectSensorManager, KinectSensor sensor)
        {
            kinectSensorManager.ColorFormat = ColorImageFormat.RgbResolution640x480Fps30;
            kinectSensorManager.ColorStreamEnabled = true;

            sensor.SkeletonFrameReady += this.SkeletonsReady;
            kinectSensorManager.TransformSmoothParameters = new TransformSmoothParameters
            {
                Smoothing = 0.5f,
                Correction = 0.5f,
                Prediction = 0.5f,
                JitterRadius = 0.05f,
                MaxDeviationRadius = 0.04f
            };
            kinectSensorManager.SkeletonStreamEnabled = true;
            kinectSensorManager.KinectSensorEnabled = true;

            // initialize the gesture recognizer
            gestureController = new GestureController();
            gestureController.GestureRecognized += OnGestureRecognized;
        }