コード例 #1
0
        private void ShowPointer(VirtualPointer pointer)
        {
            Canvas.SetLeft(this.FingerPointer, pointer.Position.X);
            Canvas.SetTop(this.FingerPointer, pointer.Position.Y);

            // This is kind of an assumption that you are approximately (2 x physical screen width) far away from your screen
            // but at this point we are already working with pixels instead of centimeters
            var effectiveHorizontalResolution = SystemParameters.PrimaryScreenWidth / 2;

            this.ScaleTransform.ScaleX = this.ScaleTransform.ScaleY = (pointer.Depth / effectiveHorizontalResolution);
        }
コード例 #2
0
        private void SetupKinectSensor()
        {
            var kinectBodyTracker = new KinectBodyTracker();

            var screenCoordinates = kinectBodyTracker.TrackedJoints
                                    .Select(joints => VirtualPointer.Create(joints, this.geometryHelper))
                                    .Buffer(10, 1)
                                    .Select(buffer => this.SmoothVirtualPointer(buffer));

            screenCoordinates
            .Do(pointer => this.ShowPointer(pointer))
            .Subscribe();
        }