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

220 lines
13 KiB
XML

<UserControl x:Class="Views.Vision.V_FindCircle"
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"
d:DesignHeight="450" d:DesignWidth="800" 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="1" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="White" Text="列间距" />
<TextBox Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="1" Margin="1"
VerticalAlignment="Center" VerticalContentAlignment="Center"
Background="Transparent" Foreground="White"
Text="{Binding CircularCenterDistanceColum}" />
<TextBlock Grid.Row="5" Grid.ColumnSpan="1" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="White" Text="行间距" />
<TextBox Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="1" Margin="1"
VerticalAlignment="Center" VerticalContentAlignment="Center"
Background="Transparent" Foreground="White"
Text="{Binding CircularCenterDistanceRow}" />
<TextBlock Grid.Row="4" Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="White" Text="行基准" />
<TextBox Grid.Row="4" Grid.Column="3" Grid.ColumnSpan="1" Margin="1"
VerticalAlignment="Center" VerticalContentAlignment="Center"
Background="Transparent" Foreground="White"
Text="{Binding CalibrationRowBase}" />
<TextBlock Grid.Row="5" Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="White" Text="列基准" />
<TextBox Grid.Row="5" Grid.Column="3" Grid.ColumnSpan="1" Margin="1"
VerticalAlignment="Center" VerticalContentAlignment="Center"
Background="Transparent" Foreground="White"
Text="{Binding CalibrationColumnBase}" />
<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}" />
<CheckBox Grid.Row="6" Grid.Column ="2" Grid.ColumnSpan="2"
HorizontalAlignment="Center"
Content="更新参考" Foreground="White"
IsChecked="{Binding SelectVEI.UpdateRef}"
Style="{StaticResource CheckBoxStyle1}" />
</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>
<GroupBox Grid.Row="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 ShapeB_Min}" />
<Label Grid.Row="1" Content="最大值" Foreground="White" />
<TextBox Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Background="Transparent" Foreground="White" Text="{Binding ShapeB_Max}" />
</Grid>
</GroupBox>
<GroupBox Grid.Row="1" 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="Row" Foreground="White" />
<TextBox Grid.Column="1" VerticalAlignment="Center" Background="Transparent" Foreground="White" Text="{Binding ShapeC_Min}" />
<Label Grid.Row="1" Content="Column" Foreground="White" />
<TextBox Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Background="Transparent" Foreground="White" Text="{Binding ShapeC_Max}" />
</Grid>
</GroupBox>
<Border Grid.Row="2" Grid.ColumnSpan="2">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Button Margin="1" Background="{Binding BorderBrush, ElementName=TAB1}" Command="{Binding LocationSettingCommand}" Style="{DynamicResource commBtn}">
<Viewbox>
<Label Content="定位设置" Foreground="White" />
</Viewbox>
</Button>
<Button Grid.Column="1" Margin="1" Background="{Binding BorderBrush, ElementName=TAB1}" Command="{Binding ThresholdRunCommand}" Style="{DynamicResource commBtn}">
<Viewbox>
<Label Content="二值化预览" Foreground="White" />
</Viewbox>
</Button>
<Button Grid.Row="3" Margin="1" Background="{Binding BorderBrush, ElementName=TAB1}" Command="{Binding LocationCheckCommand}" Style="{DynamicResource commBtn}">
<Viewbox>
<Label Content="定位测试" Foreground="White" />
</Viewbox>
</Button>
<Button Grid.Row="3" Grid.Column="1" Margin="1" Background="{Binding BorderBrush, ElementName=TAB1}" Command="{Binding SaveInspectPerCommand}" Style="{DynamicResource commBtn}">
<Viewbox>
<Label Content="保存" Foreground="White" />
</Viewbox>
</Button>
</Grid>
</Border>
</Grid>
</Border>
</Grid>
</GroupBox>
</UserControl>