| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Linq;
- using System.Runtime.CompilerServices;
- using System.Text;
- using System.Threading.Tasks;
- using TeamAAS_VP.Enums;
- namespace TeamAAS_VP.Models
- {
- /// <summary>
- /// 输入参数
- /// </summary>
- public class AnalysisParameters : INotifyPropertyChanged
- {
- private FocusMethod _focusMethod = FocusMethod.Tenengrad;
- private AnalysisMode _analysisMode = AnalysisMode.AutoCheckerboard;
- private int _targetBrightness = 128;
- private double _sharpnessThreshold = 10;
- private double _contrastThreshold = 50;
- private bool _enableRealtimeAnalysis = true;
- private bool _autoAdjustBrightness = true;
- public FocusMethod FocusMethod
- {
- get => _focusMethod;
- set => SetField(ref _focusMethod, value);
- }
- public AnalysisMode AnalysisMode
- {
- get => _analysisMode;
- set => SetField(ref _analysisMode, value);
- }
- public int TargetBrightness
- {
- get => _targetBrightness;
- set => SetField(ref _targetBrightness, value);
- }
- public double SharpnessThreshold
- {
- get => _sharpnessThreshold;
- set => SetField(ref _sharpnessThreshold, value);
- }
- public double ContrastThreshold
- {
- get => _contrastThreshold;
- set => SetField(ref _contrastThreshold, value);
- }
- public bool EnableRealtimeAnalysis
- {
- get => _enableRealtimeAnalysis;
- set => SetField(ref _enableRealtimeAnalysis, value);
- }
- public bool AutoAdjustBrightness
- {
- get => _autoAdjustBrightness;
- set => SetField(ref _autoAdjustBrightness, value);
- }
- public event PropertyChangedEventHandler PropertyChanged;
- protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
- }
- protected bool SetField<T>(ref T field, T value, [CallerMemberName] string propertyName = null)
- {
- if (EqualityComparer<T>.Default.Equals(field, value)) return false;
- field = value;
- OnPropertyChanged(propertyName);
- return true;
- }
- /// <summary>
- /// 重置为默认值
- /// </summary>
- public void ResetToDefaults()
- {
- FocusMethod = FocusMethod.Tenengrad;
- AnalysisMode = AnalysisMode.AutoCheckerboard;
- TargetBrightness = 128;
- SharpnessThreshold = 10;
- ContrastThreshold = 50;
- EnableRealtimeAnalysis = true;
- AutoAdjustBrightness = true;
- }
- }
- }
|