/// <summary> /// Save an array of camera frames /// </summary> /// <param name="body">The body(ies) we are attempting to track</param> private void SaveCameraFrame(Body body) { if (body != null && this.canTrackBodies && body.IsTracked) { // Tracking skeleton -- save video to file CameraIO.SaveFrame(); } else { Debug.WriteLine("------STOPPED: No longer tracking-------"); } }
/// <summary> /// Save an array of camera frames /// </summary> /// <param name="body">The _body(ies) we are attempting to track</param> private void SaveCameraFrame(Body body) { //if (_body != null && this.bodyTracked && _body.IsTracked) if (body != null) { // Tracking skeleton -- save video to file CameraIO.SaveFrame(); Debug.WriteLine("Saving Frame"); } // TODO: Can probably get rid of this else { //isTracking = false; Debug.WriteLine("------STOPPED: No longer tracking-------"); } }
/// <summary> /// Initializes a new instance of the MainWindow class. /// </summary> public MainWindow() { // get the kinectSensor object this.kinectSensor = KinectSensor.GetDefault(); // open the reader for the color frames this.colorFrameReader = this.kinectSensor.ColorFrameSource.OpenReader(); // wire handler for frame arrival this.colorFrameReader.FrameArrived += this.Reader_ColorFrameArrived; // create the colorFrameDescription from the ColorFrameSource using Bgra format FrameDescription colorFrameDescription = this.kinectSensor.ColorFrameSource.CreateFrameDescription(ColorImageFormat.Bgra); // create the bitmap to display this.colorBitmap = new WriteableBitmap(colorFrameDescription.Width, colorFrameDescription.Height, 96.0, 96.0, PixelFormats.Bgr32, null); // set IsAvailableChanged event notifier this.kinectSensor.IsAvailableChanged += this.Sensor_IsAvailableChanged; // open the sensor this.kinectSensor.Open(); // set the status text this.StatusText = this.kinectSensor.IsAvailable ? Properties.Resources.RunningStatusText : Properties.Resources.NoSensorStatusText; // use the window object as the view model in this simple example this.DataContext = this; // initialize the components (controls) of the window this.InitializeComponent(); kinectManager = new KinectManager(); CameraIo = new CameraIO(this); }