コード例 #1
0
ファイル: GestureFactory.cs プロジェクト: atosorigin/Kinect
 public static AccelerationGesture AddAccelerationGesture(this User user)
 {
     var gesture = new AccelerationGesture();
     var fpsFilter = new FramesFilter(6);
     user.AttachPipeline(fpsFilter);
     fpsFilter.AttachPipeline(gesture);
     return gesture;
 }
コード例 #2
0
ファイル: GestureFactory.cs プロジェクト: atosorigin/Kinect
 public static SemaphoreGesture AddSemaphoreTouchGesture(this User user)
 {
     var gesture = new SemaphoreGesture();
     var fpsFilter = new FramesFilter(6);
     user.AttachPipeline(fpsFilter);
     fpsFilter.AttachPipeline(gesture);
     return gesture;
 }
コード例 #3
0
        public static AccelerationGesture AddAccelerationGesture(this User user)
        {
            var gesture   = new AccelerationGesture();
            var fpsFilter = new FramesFilter(6);

            user.AttachPipeline(fpsFilter);
            fpsFilter.AttachPipeline(gesture);
            return(gesture);
        }
コード例 #4
0
        public static SemaphoreGesture AddSemaphoreTouchGesture(this User user)
        {
            var gesture   = new SemaphoreGesture();
            var fpsFilter = new FramesFilter(6);

            user.AttachPipeline(fpsFilter);
            fpsFilter.AttachPipeline(gesture);
            return(gesture);
        }
コード例 #5
0
        private void KinectUserCreated(object sender, KinectUserEventArgs e)
        {
            WindowMessage = "User found";
            lock (SyncRoot)
            {
                if (_activeUser != null)
                {
                    return;
                }
                _activeUser          = _kinect.GetUser(e.User.Id);
                _activeUser.Updated += ActiveUserUpdated;

                var framesFilter = new FramesFilter(15);

                //Initialize filters
                _lefthandRighthandCollision     = new CollisionFilter(new Point3D(100, 50, 130), JointID.HandLeft, JointID.HandRight);
                _lefthandHeadCollision          = new CollisionFilter(new Point3D(150, 30, 500), JointID.HandLeft, JointID.Head);
                _lefthandRightShoulderCollision = new CollisionFilter(new Point3D(50, 50, 300), JointID.HandLeft, JointID.ShoulderRight);
                _righthandHeadCollision         = new CollisionFilter(new Point3D(125, 40, 150), JointID.HandRight, JointID.Head);
                _righthandLeftShoulderCollision = new CollisionFilter(new Point3D(50, 50, 300), JointID.HandRight, JointID.ShoulderLeft);
                _righthandRightHipCollision     = new CollisionFilter(new Point3D(80, 30, 200), JointID.HandRight, JointID.HipRight);

                //Initialize gestures
                _lefthandRighthandGesture     = new SelfTouchGesture(1);
                _lefthandHeadGesture          = new SelfTouchGesture(1);
                _lefthandRightShoulderGesture = new SelfTouchGesture(1);
                _righthandHeadGesture         = new SelfTouchGesture(1);
                _righthandLeftShoulderGesture = new SelfTouchGesture(1);
                _righthandRightHipGesture     = new SelfTouchGesture(1);

                //Attach filters and gestures
                _activeUser.AttachPipeline(framesFilter);
                framesFilter.AttachPipeline(_lefthandRighthandCollision);
                framesFilter.AttachPipeline(_lefthandHeadCollision);
                framesFilter.AttachPipeline(_lefthandRightShoulderCollision);
                framesFilter.AttachPipeline(_righthandHeadCollision);
                framesFilter.AttachPipeline(_righthandLeftShoulderCollision);
                framesFilter.AttachPipeline(_righthandRightHipCollision);
                _lefthandRighthandCollision.AttachPipeline(_lefthandRighthandGesture);
                _lefthandHeadCollision.AttachPipeline(_lefthandHeadGesture);
                _lefthandRightShoulderCollision.AttachPipeline(_lefthandRightShoulderGesture);
                _righthandHeadCollision.AttachPipeline(_righthandHeadGesture);
                _righthandLeftShoulderCollision.AttachPipeline(_righthandLeftShoulderGesture);
                _righthandRightHipCollision.AttachPipeline(_righthandRightHipGesture);

                _righthandLeftShoulderGesture.SelfTouchDetected += SwitchMode;

                //Debug info
                //_righthandLeftShoulderCollision.Filtered += (s, args) => ShowDebugInfo(args, "Filter info: ");
                _lefthandRightShoulderGesture.SelfTouchDetected += FireCustomEvent;
                SwitchMode(null, null);
            }
        }
コード例 #6
0
ファイル: MainViewModel.cs プロジェクト: atosorigin/Kinect
        private void KinectUserCreated(object sender, KinectUserEventArgs e)
        {
            WindowMessage = "User found";
            lock (SyncRoot)
            {
                if (_activeUser != null)
                {
                    return;
                }
                _activeUser = _kinect.GetUser(e.User.Id);
                _activeUser.Updated += ActiveUserUpdated;

                var framesFilter = new FramesFilter(15);

                //Initialize filters
                _lefthandRighthandCollision = new CollisionFilter(new Point3D(100, 50, 130), JointID.HandLeft, JointID.HandRight);
                _lefthandHeadCollision = new CollisionFilter(new Point3D(150, 30, 500), JointID.HandLeft, JointID.Head);
                _lefthandRightShoulderCollision = new CollisionFilter(new Point3D(50, 50, 300), JointID.HandLeft, JointID.ShoulderRight);
                _righthandHeadCollision = new CollisionFilter(new Point3D(125, 40, 150), JointID.HandRight, JointID.Head);
                _righthandLeftShoulderCollision = new CollisionFilter(new Point3D(50, 50, 300), JointID.HandRight, JointID.ShoulderLeft);
                _righthandRightHipCollision = new CollisionFilter(new Point3D(80, 30, 200), JointID.HandRight, JointID.HipRight);

                //Initialize gestures
                _lefthandRighthandGesture = new SelfTouchGesture(1);
                _lefthandHeadGesture = new SelfTouchGesture(1);
                _lefthandRightShoulderGesture = new SelfTouchGesture(1);
                _righthandHeadGesture = new SelfTouchGesture(1);
                _righthandLeftShoulderGesture = new SelfTouchGesture(1);
                _righthandRightHipGesture = new SelfTouchGesture(1);

                //Attach filters and gestures
                _activeUser.AttachPipeline(framesFilter);
                framesFilter.AttachPipeline(_lefthandRighthandCollision);
                framesFilter.AttachPipeline(_lefthandHeadCollision);
                framesFilter.AttachPipeline(_lefthandRightShoulderCollision);
                framesFilter.AttachPipeline(_righthandHeadCollision);
                framesFilter.AttachPipeline(_righthandLeftShoulderCollision);
                framesFilter.AttachPipeline(_righthandRightHipCollision);
                _lefthandRighthandCollision.AttachPipeline(_lefthandRighthandGesture);
                _lefthandHeadCollision.AttachPipeline(_lefthandHeadGesture);
                _lefthandRightShoulderCollision.AttachPipeline(_lefthandRightShoulderGesture);
                _righthandHeadCollision.AttachPipeline(_righthandHeadGesture);
                _righthandLeftShoulderCollision.AttachPipeline(_righthandLeftShoulderGesture);
                _righthandRightHipCollision.AttachPipeline(_righthandRightHipGesture);

                _righthandLeftShoulderGesture.SelfTouchDetected += SwitchMode;

                //Debug info
                //_righthandLeftShoulderCollision.Filtered += (s, args) => ShowDebugInfo(args, "Filter info: ");
                _lefthandRightShoulderGesture.SelfTouchDetected += FireCustomEvent;
                SwitchMode(null, null);
            }
        }