Exemplo n.º 1
0
 /// <summary>
 /// Builds a new sensor controller instance.
 /// </summary>
 public KinectSensorController(KinectSensorType type = KinectSensorType.WindowsSensor)
 {
     // Select a kinect sensor, if one is available.
     if (KinectSensor.KinectSensors.Count > 0)
     {
         this.sensor = KinectSensor.KinectSensors[0];
         this.trackingId = -1;
         this.ConfigureSensor(type);
         this.ConfigureGestureController();
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Configures the Kinect sensor.
        /// </summary>
        private void ConfigureSensor(KinectSensorType type)
        {
            // Near mode is only avaible in Kinect for Windows.
            if (type == KinectSensorType.WindowsSensor)
            {
                // Enable near mode.
                this.sensor.DepthStream.Range = DepthRange.Near;
                this.sensor.SkeletonStream.EnableTrackingInNearRange = true;
            }

            // Disable specific skeleton tracking.
            this.sensor.SkeletonStream.AppChoosesSkeletons = false;

            // Enable needed streams.
            this.sensor.SkeletonStream.Enable();
            this.sensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);

            // Register skeleton frame ready callback.
            this.sensor.SkeletonFrameReady += callback_SkeletonFrameReady;
        }