示例#1
0
        private void droneController_VideoFrameArrived(object sender, DroneController.VideoFrameArrivedEventArgs args)
        {
            //updateBattery();
            Bitmap bitImage = args.image;

            if (FaceDectectCheck.IsChecked == true)
            {
                bitImage = FaceDetectController.detectFace(bitImage);
            }

            //DroneImage.Source = VideoHelper.ChangeBitmapToImageSource(bitImage);
            if (this.isDroneOn)
            {
                DroneEllipse.Fill = System.Windows.Media.Brushes.Green;
            }
            else if (!this.isDroneOn)
            {
                DroneEllipse.Fill = System.Windows.Media.Brushes.Red;
            }

            this.DroneImageSource = VideoHelper.ChangeBitmapToImageSource(bitImage);
        }
示例#2
0
        private void tmrVideoUpdate_Tick(object sender, EventArgs e)
        {
            if (this._altitude != _client.NavigationData.Altitude)
            {
                this._altitude = _client.NavigationData.Altitude;
                AltitudeChanged(this, new AltitudeChangedEventArgs {
                    altitude = _altitude
                });
            }
            if (this._battery.Percentage != _client.NavigationData.Battery.Percentage)
            {
                this._battery.Percentage = _client.NavigationData.Battery.Percentage;
                BatteryChanged(this, new BatteryChangedEventArgs {
                    battery = _battery
                });
            }

            if (_frame == null || _frameNumber == _frame.Number)
            {
                return;
            }
            _frameNumber = _frame.Number;

            if (_frameBitmap == null)
            {
                _frameBitmap = VideoHelper.CreateBitmap(ref _frame);
            }
            else
            {
                VideoHelper.UpdateBitmap(ref _frameBitmap, ref _frame);
            }


            VideoFrameArrived(_client, new VideoFrameArrivedEventArgs {
                image = _frameBitmap
            });
        }