private void DisableBackgroundRemoval(KinectSensor OldSensor)
 {
     if (backgroundObj != null)
     {
         backgroundObj.BackgroundStop(OldSensor);
         backgroundObj = null;
     }
 }
        private void InitiateBackgroundRemoval()
        {
            //Create BackgroundRemovalLib Obj with active sensor
            backgroundObj = new BackgroundRemovalLib(this.sensorChooser.Kinect);
            backgroundObj.BackgroundStart();

            //Tie image source to output of object
            this.Image.Source = backgroundObj.getBackgroundRemovedImage();
        }
        /// <summary>
        /// Starts the background removal process
        /// </summary>
        private void InitiateBackgroundRemoval(KinectSensor newSensor)
        {
            //Create BackgroundRemovalLib Obj with active sensor
            this.backgroundRemovedColorStream = new BackgroundRemovedColorStream(newSensor);
            backgroundObj = new BackgroundRemovalLib(this.sensorChooser, this.backgroundRemovedColorStream);
            backgroundObj.BackgroundStart();

            //this.backgroundRemovedColorStream = backgroundObj.getBackgroundRemovedColorStream();

            //Tie image source to output of object
            //this.Image.Source = backgroundObj.getBackgroundRemovedImage();

            backgroundObj.setImageSource(this.Image.Source);

            // Add an event handler to be called when the background removed color frame is ready, so that we can
            // composite the image and output to the app
            this.backgroundRemovedColorStream.BackgroundRemovedFrameReady += backgroundObj.BackgroundRemovedFrameReadyHandler;

            // Add an event handler to be called whenever there is new depth frame data
            newSensor.AllFramesReady += backgroundObj.SensorAllFramesReady;
        }