Feiyu/Views/Vision/V_Inspect.xaml
2025-12-10 17:55:48 +08:00

154 lines
11 KiB
XML

<UserControl x:Class="Views.Vision.V_Inspect"
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:Views.Vision"
xmlns:myconver="clr-namespace:Community;assembly=Community"
xmlns:model="clr-namespace:Model.Vision;assembly=Model"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="500">
<GroupBox Name="GB" Header="{Binding SelectVEI.VEIname}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Border>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Button Grid.Row="1" Grid.ColumnSpan="4" Content="相机采集" FontSize="20" Style="{DynamicResource commBtn}" Background="{Binding BorderBrush, ElementName=TAB1}" Command="{Binding GetImageCommand}" Margin="0,2"/>
<TextBox Grid.ColumnSpan="3" Text="{Binding ImgPath}" IsReadOnly="True" VerticalContentAlignment="Center" Background="Transparent" Foreground="White"/>
<Button Grid.Column="4" Grid.ColumnSpan="2" Style="{DynamicResource commBtn}" Background="{Binding BorderBrush, ElementName=TAB1}" Content="加载图片" Command="{Binding LoadingImageCommand}" Margin="1,3" />
<CheckBox Content="使用本地图像" Grid.Row="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Style="{StaticResource CheckBoxStyle1}" Foreground="White" BorderBrush="{Binding BorderBrush, ElementName=GB}" IsChecked="{Binding EnableLocalImage}"/>
<RadioButton GroupName="A" Grid.Row="3" Content="矩形" Background="Transparent" Foreground="White" Command="{Binding RoiShapeSelectCommand}" CommandParameter="R1"/>
<RadioButton GroupName="A" Grid.Row="3" Grid.Column="1" Content="矩形2" Background="Transparent" Foreground="White" Command="{Binding RoiShapeSelectCommand}" CommandParameter="R2"/>
<RadioButton GroupName="A" Grid.Row="3" Grid.Column="2" Content="圆形" Background="Transparent" Foreground="White" Command="{Binding RoiShapeSelectCommand}" CommandParameter="C"/>
<TextBlock Grid.Row="2" Grid.Column="3" Text="识别系数" Foreground="White" VerticalAlignment="Center"/>
<ComboBox Grid.Row="3" Grid.Column="3" VerticalContentAlignment="Center" VerticalAlignment="Center" ItemsSource="{Binding CoeList}" SelectedItem="{Binding SelectVEI. ImageCorrectionRM.MyROI.RecognitionCoefficient}" Background="Transparent" Foreground="White"/>
<Button Grid.Row="4" Grid.ColumnSpan="2" Content="校正设置" Style="{DynamicResource commBtn}" Background="{Binding BorderBrush, ElementName=TAB1}" FontSize="20" Margin="1" Command="{Binding CreateImageCorrectionModelCommand}"/>
<Button Grid.Row="4" Grid.Column="2" Grid.ColumnSpan="2" Content="校正测试" Style="{DynamicResource commBtn}" Background="{Binding BorderBrush, ElementName=TAB1}" FontSize="20" Margin="1" Command="{Binding ImageCorrectionTestCommand}"/>
<Button Grid.Row="5" Grid.ColumnSpan="2" Content="区域设置" Style="{DynamicResource commBtn}" Background="{Binding BorderBrush, ElementName=TAB1}" FontSize="20" Margin="1" Command="{Binding InspectionFeaturesEditCommand}"/>
<Button Grid.Row="5" Grid.Column="2" Grid.ColumnSpan="2" Content="检查测试" Style="{DynamicResource commBtn}" Background="{Binding BorderBrush, ElementName=TAB1}" FontSize="20" Margin="1" Command="{Binding InspectionFeaturesTestCommand}"/>
</Grid>
</Border>
<Border Grid.Column="1" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<GroupBox Grid.RowSpan="2" Header="二值化">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Content="最小值" Foreground="White"></Label>
<TextBox Text="{Binding SelectModel.MyROI.ThresholdMin}" Background="Transparent" Foreground="White" Grid.Column="1" VerticalAlignment="Center"></TextBox>
<Label Content="最大值" Grid.Row="1" Foreground="White"></Label>
<TextBox Text="{Binding SelectModel.MyROI.ThresholdMax}" Background="Transparent" Foreground="White" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center"></TextBox>
<Button Grid.Row="2" Grid.ColumnSpan="2" Content="二值化处理" Style="{DynamicResource commBtn}" Background="{Binding BorderBrush, ElementName=TAB1}" Command="{Binding ThresholdRunCommand}"></Button>
<Button Grid.Row="3" Grid.ColumnSpan="2" Grid.RowSpan="2" Content="保存" Style="{DynamicResource commBtn}" Background="{Binding BorderBrush, ElementName=TAB1}" FontSize="20" Margin="3" Command="{Binding SaveInspectPerCommand}"/>
</Grid>
</GroupBox>
<GroupBox Grid.Row="2" Header="边框" DataContext="{Binding SelectModel.MyROI}">
<Grid >
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Content="最小值" Foreground="White"></Label>
<TextBox Text="{Binding ShapeA_Min}" Background="Transparent" Foreground="White" Grid.Column="1" VerticalAlignment="Center"></TextBox>
<Label Content="最大值" Grid.Row="1" Foreground="White"></Label>
<TextBox Text="{Binding ShapeA_Max}" Background="Transparent" Foreground="White" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center"></TextBox>
</Grid>
</GroupBox>
<GroupBox Grid.Column="1" Header="圆形" DataContext="{Binding SelectModel.MyROI}">
<Grid >
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Content="最小值" Foreground="White"></Label>
<TextBox Text="{Binding ShapeB_Min}" Background="Transparent" Foreground="White" Grid.Column="1" VerticalAlignment="Center"></TextBox>
<Label Content="最大值" Grid.Row="1" Foreground="White"></Label>
<TextBox Text="{Binding ShapeB_Max}" Background="Transparent" Foreground="White" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center"></TextBox>
</Grid>
</GroupBox>
<GroupBox Grid.Row="1" Grid.Column="1" Header="矩形" DataContext="{Binding SelectModel.MyROI}">
<Grid >
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Content="最小值" Foreground="White"></Label>
<TextBox Text="{Binding ShapeC_Min}" Background="Transparent" Foreground="White" Grid.Column="1" VerticalAlignment="Center"></TextBox>
<Label Content="最大值" Grid.Row="1" Foreground="White"></Label>
<TextBox Text="{Binding ShapeC_Max}" Background="Transparent" Foreground="White" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center"></TextBox>
</Grid>
</GroupBox>
<GroupBox Grid.Row="2" Grid.Column="1" Header="三角形" DataContext="{Binding SelectModel.MyROI}">
<Grid >
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Content="最小值" Foreground="White"></Label>
<TextBox Text="{Binding ShapeD_Min}" Background="Transparent" Foreground="White" Grid.Column="1" VerticalAlignment="Center"></TextBox>
<Label Content="最大值" Grid.Row="1" Foreground="White"></Label>
<TextBox Text="{Binding ShapeD_Max}" Background="Transparent" Foreground="White" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center"></TextBox>
</Grid>
</GroupBox>
</Grid>
</Border>
</Grid>
</GroupBox>
</UserControl>