motorTest/Views/Vision/V_Inspect.xaml
2026-10-17 11:39:30 +08:00

173 lines
10 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:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Views.Vision"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:model="clr-namespace:Model.Vision;assembly=Model"
xmlns:myconver="clr-namespace:Community;assembly=Community"
d:DesignHeight="300" d:DesignWidth="500" mc:Ignorable="d">
<GroupBox Name="GB" Padding="0" Header="{Binding SelectVEI.VEIname}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Border>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Button Grid.Row="1" Grid.ColumnSpan="4" Margin="0,2"
Background="{Binding BorderBrush, ElementName=TAB1}"
Command="{Binding GetImageCommand}"
Content="相机采集" FontSize="20"
Style="{DynamicResource commBtn}" />
<TextBox Grid.ColumnSpan="3" VerticalAlignment="Center"
VerticalContentAlignment="Center" Background="Transparent"
Foreground="White" IsReadOnly="True"
Text="{Binding ImgPath}" />
<Button Grid.Column="4" Grid.ColumnSpan="2" Margin="1,6"
Background="{Binding BorderBrush, ElementName=TAB1}"
Command="{Binding LoadingImageCommand}"
Content="加载图片"
Style="{DynamicResource commBtn}" />
<CheckBox Grid.Row="2" Grid.ColumnSpan="2"
BorderBrush="{Binding BorderBrush, ElementName=GB}"
Content="使用本地图像" Foreground="White"
IsChecked="{Binding EnableLocalImage}"
Style="{StaticResource CheckBoxStyle1}" />
<RadioButton Grid.Row="3" Background="Transparent"
Command="{Binding RoiShapeSelectCommand}"
CommandParameter="R1" Content="矩形" Foreground="White"
GroupName="A" />
<RadioButton Grid.Row="3" Grid.Column="1" Background="Transparent"
Command="{Binding RoiShapeSelectCommand}"
CommandParameter="R2" Content="矩形2" Foreground="White"
GroupName="A" />
<RadioButton Grid.Row="3" Grid.Column="2" Background="Transparent"
Command="{Binding RoiShapeSelectCommand}"
CommandParameter="C" Content="圆形" Foreground="White"
GroupName="A" />
<TextBlock Grid.Row="4" Grid.ColumnSpan="2" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="White" Text="列间距" />
<TextBox Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="2" Margin="1"
VerticalAlignment="Center" VerticalContentAlignment="Center"
Background="Transparent" Foreground="White"
Text="{Binding CircularCenterDistanceColum}" />
<TextBlock Grid.Row="5" Grid.ColumnSpan="4" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="White" Text="行间距" />
<TextBox Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="2" Margin="1"
VerticalAlignment="Center" VerticalContentAlignment="Center"
Background="Transparent" Foreground="White"
Text="{Binding CircularCenterDistanceRow}" />
<TextBlock Grid.Row="4" Grid.Column="3" VerticalAlignment="Center" Foreground="White" Text="识别系数" />
<ComboBox Grid.Row="5" Grid.Column="3" VerticalAlignment="Center"
VerticalContentAlignment="Center" Background="Transparent"
Foreground="White"
ItemsSource="{Binding CoeList}"
SelectedItem="{Binding SelectVEI. ImageCorrectionRM.MyROI.RecognitionCoefficient}" />
<Button Grid.Row="6" Grid.ColumnSpan="2"
Background="{Binding BorderBrush, ElementName=TAB1}"
Command="{Binding NinePointCalibrationCommand}"
CommandParameter="{Binding RelativeSource={x:Static RelativeSource.Self}}"
Content="标定并保存" FontSize="20"
Style="{DynamicResource commBtn}" />
<Button Grid.Row="6" Grid.Column="2" Margin="1"
Background="{Binding BorderBrush, ElementName=TAB1}"
Command="{Binding CreateImageCorrectionModelCommand}"
Content="校正设置"
Style="{DynamicResource commBtn}" />
<Button Grid.Row="6" Grid.Column="3" Margin="1"
Background="{Binding BorderBrush, ElementName=TAB1}"
Command="{Binding ImageCorrectionTestCommand}"
Content="校正测试"
Style="{DynamicResource commBtn}" />
</Grid>
</Border>
<Border Grid.Column="1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<GroupBox Padding="0" Header="二值化">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Content="最小值" Foreground="White" />
<TextBox Grid.Column="1" VerticalAlignment="Center" Background="Transparent" Foreground="White" Text="{Binding SelectModel.MyROI.ThresholdMin}" />
<Label Grid.Row="1" Content="最大值" Foreground="White" />
<TextBox Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Background="Transparent" Foreground="White" Text="{Binding SelectModel.MyROI.ThresholdMax}" />
</Grid>
</GroupBox>
<GroupBox Grid.Column="1" Padding="0" DataContext="{Binding SelectModel.MyROI}" Header="阈值">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Content="最小值" Foreground="White" />
<TextBox Grid.Column="1" VerticalAlignment="Center" Background="Transparent" Foreground="White" Text="{Binding ShapeA_Min}" />
<Label Grid.Row="1" Content="最大值" Foreground="White" />
<TextBox Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Background="Transparent" Foreground="White" Text="{Binding ShapeA_Max}" />
</Grid>
</GroupBox>
<Button Grid.Row="1" Grid.Column="1" Margin="1"
Background="{Binding BorderBrush, ElementName=TAB1}"
Command="{Binding ThresholdRunCommand}"
Content="二值化处理"
Style="{DynamicResource commBtn}" />
<Button Grid.Row="2" Grid.Column="1" Margin="1"
Background="{Binding BorderBrush, ElementName=TAB1}"
Command="{Binding SaveInspectPerCommand}"
Content="保存" FontSize="20"
Style="{DynamicResource commBtn}" />
<Button Grid.Row="1" Margin="1"
Background="{Binding BorderBrush, ElementName=TAB1}"
Command="{Binding InspectionFeaturesEditCommand}"
Content="区域设置" FontSize="20"
Style="{DynamicResource commBtn}" />
<Button Grid.Row="2" Margin="1"
Background="{Binding BorderBrush, ElementName=TAB1}"
Command="{Binding InspectionFeaturesTestCommand}"
Content="检查测试" FontSize="20"
Style="{DynamicResource commBtn}" />
</Grid>
</Border>
</Grid>
</GroupBox>
</UserControl>