void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            // Set up the color picker's initial state
            _colorpicker = (FocusingStackPanel)VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(PART_ColorPickerListBox, 0), 0), 0);


            _colorpicker.FocusedQuantity = 1;

            try
            {
                if (KinectSensor.KinectSensors.Count > 0)
                {
                    //grab first
                    sensor = KinectSensor.KinectSensors[0];
                }

                if (sensor.Status != KinectStatus.Connected || KinectSensor.KinectSensors.Count == 0)
                {
                    MessageBox.Show("No Kinect connected!");
                }

                // Set up the Kinect

                var parameters = new TransformSmoothParameters
                {
                    Smoothing          = 0.3f,
                    Correction         = 0.0f,
                    Prediction         = 0.0f,
                    JitterRadius       = 1.0f,
                    MaxDeviationRadius = 0.5f
                };

                sensor.SkeletonStream.Enable(parameters);
                sensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
                sensor.Start();
            }
            catch (Exception)
            {
                // Failed to set up the Kinect. Show the error onscreen (app will switch to using mouse movement)
                sensor = null;
                PART_ErrorText.Visibility = Visibility.Visible;
            }
        }
Exemple #2
0
 void MainWindowLoaded(object sender, RoutedEventArgs e)
 {
     // Set up the color picker's initial state
     _colorpicker = (FocusingStackPanel)VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(PART_ColorPickerListBox, 0), 0), 0);
     _colorpicker.FocusedQuantity = 50;
 }
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            // Set up the color picker's initial state
            _colorpicker = (FocusingStackPanel)VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(PART_ColorPickerListBox, 0), 0), 0);
            _colorpicker.FocusedQuantity = 50;

            try
            {

                if (KinectSensor.KinectSensors.Count > 0)
                {
                    //grab first
                    sensor = KinectSensor.KinectSensors[0];
                }

                if (sensor.Status != KinectStatus.Connected || KinectSensor.KinectSensors.Count == 0)
                {
                    MessageBox.Show("No Kinect connected!"); 
                }

                // Set up the Kinect
                
                var parameters = new TransformSmoothParameters
                {
                    Smoothing = 0.3f,
                    Correction = 1.0f,
                    Prediction = 1.0f,
                    JitterRadius = 1.0f,
                    MaxDeviationRadius = 0.5f
                };
                sensor.DepthStream.Enable(DepthImageFormat.Resolution320x240Fps30);
                sensor.SkeletonStream.Enable(parameters);
                
                sensor.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(sensor_SkeletonFrameReady);
                
                sensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
                sensor.ColorFrameReady += new EventHandler<ColorImageFrameReadyEventArgs>(sensor_ColorFrameReady);
                sensor.Start(); 
                //Register Tutorial Video Capture
                
            }
            catch (Exception)
            {
                // Failed to set up the Kinect. Show the error onscreen (app will switch to using mouse movement)
                sensor = null;
                PART_ErrorText.Visibility = Visibility.Visible;
            }
        }