Ejemplo n.º 1
0
        /// Initializes a new instance of the MainWindow class.
        public MainWindow()
        {
            // get the _kinectSensor object
            this._kinectSensor = KinectSensor.GetDefault();

            // open the reader for bodyIndex frames
            this._bodyIndexFrameReader = this._kinectSensor.BodyIndexFrameSource.OpenReader();

            // wire handler for frame arrival
            this._bodyIndexFrameReader.FrameArrived += this.Reader_FrameArrived;

            this._bodyIndexFrameDescription = this._kinectSensor.BodyIndexFrameSource.FrameDescription;

            // allocate space to put the pixels being converted
            this._bodyIndexPixels = new uint[this._bodyIndexFrameDescription.Width * this._bodyIndexFrameDescription.Height];

            // create the bitmap to display
            this._bodyIndexBitmap = new WriteableBitmap(this._bodyIndexFrameDescription.Width, this._bodyIndexFrameDescription.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 a view model
            this.DataContext = this;

            // initialize the components (controls) of the window
            this.InitializeComponent();

            _kinectSensor = KinectSensor.GetDefault();

            if (_kinectSensor != null)
            {
                _kinectSensor.Open();

                _bodies = new Body[_kinectSensor.BodyFrameSource.BodyCount];

                _reader = _kinectSensor.BodyFrameSource.OpenReader();
                _reader.FrameArrived += BodyReader_FrameArrived;

                _recorder = new KinectFileManager();
            }
        }
Ejemplo n.º 2
0
        //chamar função na tela inicial para instanciar objetos (ligar o kinect)
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            _kinectSensor = KinectSensor.GetDefault();

            if (_kinectSensor != null)
            {
                _kinectSensor.Open();

                _bodies = new Body[_kinectSensor.BodyFrameSource.BodyCount];

                _reader = _kinectSensor.BodyFrameSource.OpenReader();
                _reader.FrameArrived += BodyReader_FrameArrived;

                _recorder = new KinectFileManager();
            }
        }
Ejemplo n.º 3
0
        /// Initializes a new instance of the MainWindow class.
        public MainWindow()
        {
            // get the _kinectSensor object
            this._kinectSensor = KinectSensor.GetDefault();

            // open the reader for bodyIndex frames
            this._bodyIndexFrameReader = this._kinectSensor.BodyIndexFrameSource.OpenReader();

            // wire handler for frame arrival
            this._bodyIndexFrameReader.FrameArrived += this.Reader_FrameArrived;

            this._bodyIndexFrameDescription = this._kinectSensor.BodyIndexFrameSource.FrameDescription;

            // allocate space to put the pixels being converted
            this._bodyIndexPixels = new uint[this._bodyIndexFrameDescription.Width * this._bodyIndexFrameDescription.Height];

            // create the bitmap to display
            this._bodyIndexBitmap = new WriteableBitmap(this._bodyIndexFrameDescription.Width, this._bodyIndexFrameDescription.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 a view model
            this.DataContext = this;

            // initialize the components (controls) of the window
            this.InitializeComponent();

            _kinectSensor = KinectSensor.GetDefault();

            if (_kinectSensor != null)
            {
                _kinectSensor.Open();

                _bodies = new Body[_kinectSensor.BodyFrameSource.BodyCount];

                _reader = _kinectSensor.BodyFrameSource.OpenReader();
                _reader.FrameArrived += BodyReader_FrameArrived;

                _recorder = new KinectFileManager();
            }
        }
Ejemplo n.º 4
0
        //chamar função na tela inicial para instanciar objetos (ligar o kinect)
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            _kinectSensor = KinectSensor.GetDefault();

            if (_kinectSensor != null)
            {
                _kinectSensor.Open();

                _bodies = new Body[_kinectSensor.BodyFrameSource.BodyCount];

                _reader = _kinectSensor.BodyFrameSource.OpenReader();
                _reader.FrameArrived += BodyReader_FrameArrived;

                _recorder = new KinectFileManager();
            }
        }