| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- <UserControl x:Class="TeamAAS_VP.Controls.FocusAnalyzerControl"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:local="clr-namespace:TeamAAS_VP.Controls"
- xmlns:oxy="http://oxyplot.org/wpf"
- mc:Ignorable="d"
- d:DesignHeight="600"
- d:DesignWidth="800">
- <UserControl.Resources>
- <Style x:Key="CardStyle"
- TargetType="Border">
- <Setter Property="Background"
- Value="#FFFFFF" />
- <Setter Property="CornerRadius"
- Value="4" />
- <Setter Property="BorderBrush"
- Value="#E0E0E0" />
- <Setter Property="BorderThickness"
- Value="1" />
- <Setter Property="Padding"
- Value="8" />
- <Setter Property="Margin"
- Value="4" />
- </Style>
- <Style x:Key="ValueTextStyle"
- TargetType="TextBlock">
- <Setter Property="FontSize"
- Value="14" />
- <Setter Property="FontWeight"
- Value="SemiBold" />
- <Setter Property="Margin"
- Value="0,2,0,4" />
- </Style>
- </UserControl.Resources>
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="300" />
- </Grid.ColumnDefinitions>
- <!-- 左侧:图像显示和图表 -->
- <Grid Grid.Column="0">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="*" />
- <RowDefinition Height="200" />
- </Grid.RowDefinitions>
- <!-- 状态栏 -->
- <Border Grid.Row="0"
- Style="{StaticResource CardStyle}">
- <StackPanel Orientation="Horizontal">
- <TextBlock Text="状态: "
- FontWeight="Bold" />
- <TextBlock x:Name="StatusText"
- Text="就绪"
- Margin="5,0,0,0" />
- <TextBlock x:Name="FrameCountText"
- Text="帧数: 0"
- Margin="20,0,0,0" />
- <TextBlock x:Name="BestSharpnessText"
- Text="最佳: 0.00"
- Margin="20,0,0,0" />
- <Button x:Name="StartButton"
- Content="开始分析"
- Command="{Binding StartCommand}"
- Margin="20,0,5,0"
- Padding="10,4" />
- <Button x:Name="StopButton"
- Content="停止分析"
- Command="{Binding StopCommand}"
- Margin="5,0,0,0"
- Padding="10,4" />
- </StackPanel>
- </Border>
- <!-- 图像显示 -->
- <Border Grid.Row="1"
- Style="{StaticResource CardStyle}"
- Margin="0,4,0,4">
- <Grid>
- <Image x:Name="ImageDisplay"
- Source="{Binding CurrentImage}"
- Stretch="Uniform" />
- <!-- ROI绘制层 -->
- <Canvas x:Name="RoiCanvas"
- IsHitTestVisible="False">
- <Rectangle x:Name="RoiRectangle"
- Stroke="Red"
- StrokeThickness="2"
- StrokeDashArray="4,4"
- Visibility="Collapsed" />
- </Canvas>
- </Grid>
- </Border>
- <!-- 曲线图表 -->
- <Border Grid.Row="2"
- Style="{StaticResource CardStyle}">
- <oxy:PlotView x:Name="SharpnessPlot"
- Model="{Binding PlotModel}" />
- </Border>
- </Grid>
- <!-- 右侧:参数和结果显示 -->
- <Grid Grid.Column="1"
- Margin="4,0,0,0">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
- <!-- 参数设置 -->
- <Border Grid.Row="0"
- Style="{StaticResource CardStyle}">
- <StackPanel>
- <TextBlock Text="分析参数"
- FontWeight="Bold"
- Margin="0,0,0,8" />
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="80" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <TextBlock Grid.Row="0"
- Grid.Column="0"
- Text="算法:"
- VerticalAlignment="Center" />
- <ComboBox Grid.Row="0"
- Grid.Column="1"
- ItemsSource="{Binding FocusMethods}"
- SelectedItem="{Binding Parameters.FocusMethod}"
- Margin="0,0,0,4" />
- <TextBlock Grid.Row="1"
- Grid.Column="0"
- Text="模式:"
- VerticalAlignment="Center" />
- <ComboBox Grid.Row="1"
- Grid.Column="1"
- ItemsSource="{Binding AnalysisModes}"
- SelectedItem="{Binding Parameters.AnalysisMode}"
- Margin="0,0,0,4" />
- <TextBlock Grid.Row="2"
- Grid.Column="0"
- Text="亮度:"
- VerticalAlignment="Center" />
- <Slider Grid.Row="2"
- Grid.Column="1"
- Minimum="0"
- Maximum="255"
- Value="{Binding Parameters.TargetBrightness}"
- Margin="0,0,0,4" />
- <CheckBox Grid.Row="3"
- Grid.Column="0"
- Grid.ColumnSpan="2"
- Content="实时分析"
- IsChecked="{Binding Parameters.EnableRealtimeAnalysis}"
- Margin="0,4,0,0" />
- </Grid>
- <Button Content="恢复默认"
- Command="{Binding ResetCommand}"
- Margin="0,8,0,0"
- Padding="8,4" />
- </StackPanel>
- </Border>
- <!-- 清晰度结果 -->
- <Border Grid.Row="1"
- Style="{StaticResource CardStyle}"
- Margin="0,4,0,0">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <StackPanel Grid.Column="0">
- <TextBlock Text="当前清晰度"
- FontSize="11"
- Foreground="#666" />
- <TextBlock Text="{Binding CurrentResult.Sharpness, StringFormat=F2}"
- Style="{StaticResource ValueTextStyle}"
- Foreground="#007ACC" />
- <ProgressBar Value="{Binding CurrentResult.Sharpness}"
- Maximum="50"
- Height="6"
- Margin="0,2,4,0" />
- </StackPanel>
- <StackPanel Grid.Column="1">
- <TextBlock Text="质量评分"
- FontSize="11"
- Foreground="#666" />
- <TextBlock Text="{Binding CurrentResult.QualityScore, StringFormat=F1}"
- Style="{StaticResource ValueTextStyle}"
- FontSize="18" />
- <TextBlock Text="/100"
- FontSize="11"
- Foreground="#999" />
- </StackPanel>
- </Grid>
- </Border>
- <!-- 棋盘格分析 -->
- <Border Grid.Row="2"
- Style="{StaticResource CardStyle}"
- Margin="0,4,0,0">
- <StackPanel>
- <TextBlock Text="棋盘格分析"
- FontWeight="Bold"
- Margin="0,0,0,8" />
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <TextBlock Grid.Row="0"
- Grid.Column="0"
- Text="状态:"
- FontSize="11"
- Foreground="#666" />
- <TextBlock Grid.Row="0"
- Grid.Column="1"
- Text="黑色均值:"
- FontSize="11"
- Foreground="#666" />
- <TextBlock Grid.Row="1"
- Grid.Column="0"
- Text="{Binding CurrentResult.Checkerboard.Detected,
- Converter={StaticResource BoolToTextConverter},
- ConverterParameter='已检测|未检测'}"
- Style="{StaticResource ValueTextStyle}" />
- <TextBlock Grid.Row="1"
- Grid.Column="1"
- Text="{Binding CurrentResult.Checkerboard.BlackMean, StringFormat=F1}"
- Style="{StaticResource ValueTextStyle}" />
- <TextBlock Grid.Row="2"
- Grid.Column="0"
- Text="对比度:"
- FontSize="11"
- Foreground="#666" />
- <TextBlock Grid.Row="2"
- Grid.Column="1"
- Text="白色均值:"
- FontSize="11"
- Foreground="#666" />
- <TextBlock Grid.Row="3"
- Grid.Column="0"
- Text="{Binding CurrentResult.Checkerboard.Contrast, StringFormat=F1}"
- Style="{StaticResource ValueTextStyle}" />
- <TextBlock Grid.Row="3"
- Grid.Column="1"
- Text="{Binding CurrentResult.Checkerboard.WhiteMean, StringFormat=F1}"
- Style="{StaticResource ValueTextStyle}" />
- </Grid>
- <TextBlock Text="建议亮度:"
- FontSize="11"
- Foreground="#666"
- Margin="0,8,0,0" />
- <TextBlock Text="{Binding CurrentResult.Checkerboard.OptimalBrightness}"
- Style="{StaticResource ValueTextStyle}"
- Foreground="#4CAF50" />
- </StackPanel>
- </Border>
- <!-- 建议列表 -->
- <Border Grid.Row="3"
- Style="{StaticResource CardStyle}"
- Margin="0,4,0,0">
- <StackPanel>
- <TextBlock Text="调整建议"
- FontWeight="Bold"
- Margin="0,0,0,8" />
- <ScrollViewer VerticalScrollBarVisibility="Auto"
- MaxHeight="200">
- <ItemsControl ItemsSource="{Binding CurrentResult.Suggestions}">
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <Border Background="#F5F5F5"
- CornerRadius="3"
- Padding="6"
- Margin="0,0,0,4">
- <TextBlock Text="{Binding}"
- TextWrapping="Wrap"
- FontSize="11" />
- </Border>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- </ScrollViewer>
- <Button Content="导出报告"
- Command="{Binding ExportCommand}"
- Margin="0,8,0,0"
- Padding="8,4" />
- </StackPanel>
- </Border>
- </Grid>
- </Grid>
- </UserControl>
|