/// <summary>
        /// Creates an instance of the AdvancedPhotoCapture, configures it to capture HDR images, and registers for its events
        /// </summary>
        /// <returns></returns>
        private async Task EnableHdrAsync()
        {
            // No work to be done if there already is an AdvancedCapture
            if (_advancedCapture != null)
            {
                return;
            }

            // Explicitly choose HDR mode
            var settings = new AdvancedPhotoCaptureSettings {
                Mode = AdvancedPhotoMode.Hdr
            };

            // Configure the mode
            _mediaCapture.VideoDeviceController.AdvancedPhotoControl.Configure(settings);

            // Prepare for an advanced capture
            _advancedCapture = await _mediaCapture.PrepareAdvancedPhotoCaptureAsync(ImageEncodingProperties.CreateJpeg());

            Debug.WriteLine("Enabled HDR mode");

            // Register for events published by the AdvancedCapture
            _advancedCapture.AllPhotosCaptured += AdvancedCapture_AllPhotosCaptured;
            _advancedCapture.OptionalReferencePhotoCaptured += AdvancedCapture_OptionalReferencePhotoCaptured;
        }
Exemple #2
0
        /// <summary>
        /// Configures the AdvancedPhotoControl to the next supported mode
        /// </summary>
        /// <remarks>
        /// Note that this method can be safely called regardless of whether the AdvancedPhotoCapture is in the "prepared
        /// state" or not. Internal changes to the mode will be applied  when calling Prepare, or when calling Capture if
        /// the mode has been changed since the call to Prepare. This allows for fast changing of desired capture modes,
        /// that can more quickly adapt to rapidly changing shooting conditions.
        /// </remarks>
        private void CycleAdvancedCaptureMode()
        {
            // Calculate the index for the next supported mode
            _advancedCaptureMode = (_advancedCaptureMode + 1) % _mediaCapture.VideoDeviceController.AdvancedPhotoControl.SupportedModes.Count;

            // Configure the settings object to the mode at the calculated index
            var settings = new AdvancedPhotoCaptureSettings
            {
                Mode = _mediaCapture.VideoDeviceController.AdvancedPhotoControl.SupportedModes[_advancedCaptureMode]
            };

            // Configure the mode on the control
            _mediaCapture.VideoDeviceController.AdvancedPhotoControl.Configure(settings);

            // Update the button text to reflect the current mode
            ModeTextBlock.Text = _mediaCapture.VideoDeviceController.AdvancedPhotoControl.Mode.ToString();
        }
Exemple #3
0
        private async Task InitializeForLowLight()
        {
            _lowLightSupported =
                _mediaCapture.VideoDeviceController.AdvancedPhotoControl.SupportedModes.Contains(Windows.Media.Devices.AdvancedPhotoMode.LowLight);

            _mediaCapture.VideoDeviceController.DesiredOptimization = MediaCaptureOptimization.Quality;

            if (_lowLightSupported)
            {
                // Choose LowLight mode
                var settings = new AdvancedPhotoCaptureSettings {
                    Mode = AdvancedPhotoMode.LowLight
                };
                _mediaCapture.VideoDeviceController.AdvancedPhotoControl.Configure(settings);

                // Prepare for an advanced capture
                _advancedCapture =
                    await _mediaCapture.PrepareAdvancedPhotoCaptureAsync(ImageEncodingProperties.CreateUncompressed(MediaPixelFormat.Nv12));
            }
        }
        /// <summary>
        /// Creates an instance of the AdvancedPhotoCapture, configures it to capture HDR images, and registers for its events
        /// </summary>
        /// <returns></returns>
        private async Task EnableHdrAsync()
        {
            // No work to be done if there already is an AdvancedCapture
            if (_advancedCapture != null) return;

            // Explicitly choose HDR mode
            var settings = new AdvancedPhotoCaptureSettings { Mode = AdvancedPhotoMode.Hdr };

            // Configure the mode
            _mediaCapture.VideoDeviceController.AdvancedPhotoControl.Configure(settings);

            // Prepare for an advanced capture
            _advancedCapture = await _mediaCapture.PrepareAdvancedPhotoCaptureAsync(ImageEncodingProperties.CreateJpeg());

            Debug.WriteLine("Enabled HDR mode");

            // Register for events published by the AdvancedCapture
            _advancedCapture.AllPhotosCaptured += AdvancedCapture_AllPhotosCaptured;
            _advancedCapture.OptionalReferencePhotoCaptured += AdvancedCapture_OptionalReferencePhotoCaptured;
        }
        /// <summary>
        /// Configures the AdvancedPhotoControl to the next supported mode
        /// </summary>
        /// <remarks>
        /// Note that this method can be safely called regardless of whether the AdvancedPhotoCapture is in the "prepared
        /// state" or not. Internal changes to the mode will be applied  when calling Prepare, or when calling Capture if
        /// the mode has been changed since the call to Prepare. This allows for fast changing of desired capture modes,
        /// that can more quickly adapt to rapidly changing shooting conditions.
        /// </remarks>
        private void CycleAdvancedCaptureMode()
        {
            // Calculate the index for the next supported mode
            _advancedCaptureMode = (_advancedCaptureMode + 1) % _mediaCapture.VideoDeviceController.AdvancedPhotoControl.SupportedModes.Count;

            // Configure the settings object to the mode at the calculated index
            var settings = new AdvancedPhotoCaptureSettings
            {
                Mode = _mediaCapture.VideoDeviceController.AdvancedPhotoControl.SupportedModes[_advancedCaptureMode]
            };

            // Configure the mode on the control
            _mediaCapture.VideoDeviceController.AdvancedPhotoControl.Configure(settings);

            // Update the button text to reflect the current mode
            ModeTextBlock.Text = _mediaCapture.VideoDeviceController.AdvancedPhotoControl.Mode.ToString();
        }