/// <summary>
 /// This event will be raised every time the effect processes a preview frame, to deliver information about the current scene in the camera preview.
 /// </summary>
 /// <param name="sender">The effect raising the event.</param>
 /// <param name="args">The event data.</param>
 private async void SceneAnalysisEffect_SceneAnalyzed(SceneAnalysisEffect sender, SceneAnalyzedEventArgs args)
 {
     await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         // Create a graphical representation of how much detail could be recovered through an HDR capture, ranging
         // from 0 ("everything is within the dynamic range of the camera") to CERTAINTY_CAP ("at this point the app
         // strongly recommends an HDR capture"), where CERTAINTY_CAP can be any number between 0 and 1.
         HdrImpactBar.Value = Math.Min(CERTAINTY_CAP, args.ResultFrame.HighDynamicRange.Certainty);
     });
 }
示例#2
0
        /// <summary>
        /// Disables and removes the scene analysis effect, and unregisters the event handler for the SceneAnalyzed event of the effect
        /// </summary>
        /// <returns></returns>
        private async Task CleanSceneAnalysisEffectAsync()
        {
            // Disable detection and unsubscribe from the events
            _sceneAnalysisEffect.HighDynamicRangeAnalyzer.Enabled = false;
            _sceneAnalysisEffect.SceneAnalyzed -= SceneAnalysisEffect_SceneAnalyzed;

            // Remove the effect from the pipeline (see ClearEffectsAsync method to remove all effects from a given stream)
            await _mediaCapture.RemoveEffectAsync(_sceneAnalysisEffect);

            Debug.WriteLine("SA effect removed from pipeline");

            // Clear the member variable that held the effect instance
            _sceneAnalysisEffect = null;
        }
        /// <summary>
        ///  Disables and removes the scene analysis effect, and unregisters the event handler for the SceneAnalyzed event of the effect
        /// </summary>
        /// <returns></returns>
        private async Task CleanSceneAnalysisEffectAsync()
        {
            // Disable detection
            _sceneAnalysisEffect.HighDynamicRangeAnalyzer.Enabled = false;

            _sceneAnalysisEffect.SceneAnalyzed -= SceneAnalysisEffect_SceneAnalyzed;

            // Remove the effect from the preview stream
            await _mediaCapture.ClearEffectsAsync(MediaStreamType.VideoPreview);

            Debug.WriteLine("SA effect removed from pipeline");

            // Clear the member variable that held the effect instance
            _sceneAnalysisEffect = null;
        }
        /// <summary>
        /// Adds scene analysis to the video preview stream, registers for its event, enables it, and gets the effect instance
        /// </summary>
        /// <returns></returns>
        private async Task CreateSceneAnalysisEffectAsync()
        {
            // Create the definition, which will contain some initialization settings
            var definition = new SceneAnalysisEffectDefinition();

            // Add the effect to the video record stream
            _sceneAnalysisEffect = (SceneAnalysisEffect)await _mediaCapture.AddVideoEffectAsync(definition, MediaStreamType.VideoPreview);

            Debug.WriteLine("SA effect added to pipeline");

            // Subscribe to notifications about scene information
            _sceneAnalysisEffect.SceneAnalyzed += SceneAnalysisEffect_SceneAnalyzed;

            // Enable HDR analysis
            _sceneAnalysisEffect.HighDynamicRangeAnalyzer.Enabled = true;
        }
        /// <summary>
        ///  Disables and removes the scene analysis effect, and unregisters the event handler for the SceneAnalyzed event of the effect
        /// </summary>
        /// <returns></returns>
        private async Task CleanSceneAnalysisEffectAsync()
        {
            // Disable detection
            _sceneAnalysisEffect.HighDynamicRangeAnalyzer.Enabled = false;

            _sceneAnalysisEffect.SceneAnalyzed -= SceneAnalysisEffect_SceneAnalyzed;

            // Remove the effect from the preview stream
            await _mediaCapture.ClearEffectsAsync(MediaStreamType.VideoPreview);

            Debug.WriteLine("SA effect removed from pipeline");

            // Clear the member variable that held the effect instance
            _sceneAnalysisEffect = null;
        }
        /// <summary>
        /// Adds scene analysis to the video preview stream, registers for its event, enables it, and gets the effect instance
        /// </summary>
        /// <returns></returns>
        private async Task CreateSceneAnalysisEffectAsync()
        {
            // Create the definition, which will contain some initialization settings
            var definition = new SceneAnalysisEffectDefinition();

            // Add the effect to the video record stream
            _sceneAnalysisEffect = (SceneAnalysisEffect)await _mediaCapture.AddVideoEffectAsync(definition, MediaStreamType.VideoPreview);

            Debug.WriteLine("SA effect added to pipeline");

            // Subscribe to notifications about scene information
            _sceneAnalysisEffect.SceneAnalyzed += SceneAnalysisEffect_SceneAnalyzed;

            // Enable HDR analysis
            _sceneAnalysisEffect.HighDynamicRangeAnalyzer.Enabled = true;
        }
 /// <summary>
 /// This event will be raised every time the effect processes a preview frame, to deliver information about the current scene in the camera preview.
 /// </summary>
 /// <param name="sender">The effect raising the event.</param>
 /// <param name="args">The event data.</param>
 private async void SceneAnalysisEffect_SceneAnalyzed(SceneAnalysisEffect sender, SceneAnalyzedEventArgs args)
 {
     await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         // Create a graphical representation of how much detail could be recovered through an HDR capture, ranging
         // from 0 ("everything is within the dynamic range of the camera") to CERTAINTY_CAP ("at this point the app
         // strongly recommends an HDR capture"), where CERTAINTY_CAP can be any number between 0 and 1.
         HdrImpactBar.Value = Math.Min(CERTAINTY_CAP, args.ResultFrame.HighDynamicRange.Certainty);
     });
 }
        /// <summary>
        /// Disables and removes the scene analysis effect, and unregisters the event handler for the SceneAnalyzed event of the effect
        /// </summary>
        /// <returns></returns>
        private async Task CleanSceneAnalysisEffectAsync()
        {
            // Disable detection and unsubscribe from the events
            _sceneAnalysisEffect.HighDynamicRangeAnalyzer.Enabled = false;
            _sceneAnalysisEffect.SceneAnalyzed -= SceneAnalysisEffect_SceneAnalyzed;

            // Remove the effect from the pipeline (see ClearEffectsAsync method to remove all effects from a given stream)
            await _mediaCapture.RemoveEffectAsync(_sceneAnalysisEffect);

            Debug.WriteLine("SA effect removed from pipeline");

            // Clear the member variable that held the effect instance
            _sceneAnalysisEffect = null;
        }
 public SceneAnalysisEffectEvents(SceneAnalysisEffect This)
 {
     this.This = This;
 }