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

186 lines
12 KiB
XML

<UserControl x:Class="Views.Vision.V_FindRectangle2"
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"
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/>
<RowDefinition/>
</Grid.RowDefinitions>
<Button Grid.Row="1" Grid.ColumnSpan="4" Style="{DynamicResource commBtn}" Background="{Binding BorderBrush, ElementName=TAB1}" Command="{Binding GetImageCommand}" Margin="0,2">
<Viewbox>
<ContentControl Content="相机采集"></ContentControl>
</Viewbox>
</Button>
<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="4" HorizontalAlignment="Center" Style="{StaticResource CheckBoxStyle1}" Foreground="White" BorderBrush="{Binding BorderBrush, ElementName=GB}" IsChecked="{Binding EnableLocalImage}"/>
<TextBlock Text="列间距" HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Row="4" Grid.ColumnSpan="1" Foreground="White"/>
<TextBox Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="1" Margin="1" VerticalContentAlignment="Center" VerticalAlignment="Center" Text="{Binding CircularCenterDistanceColum}" Background="Transparent" Foreground="White"/>
<TextBlock Text="行间距" HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Row="5" Grid.ColumnSpan="1" Foreground="White"/>
<TextBox Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="1" Margin="1" VerticalContentAlignment="Center" VerticalAlignment="Center" Text="{Binding CircularCenterDistanceRow}" Background="Transparent" Foreground="White"/>
<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 SelectModel.MyROI.ShapeD_Min}" />
<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 SelectModel.MyROI.ShapeD_Max}" />
<Button Grid.Row="6" Grid.ColumnSpan="4" Style="{DynamicResource commBtn}" Background="{Binding BorderBrush, ElementName=TAB1}" Command="{Binding NinePointCalibrationCommand}">
<Viewbox>
<ContentControl Content="标定并保存"></ContentControl>
</Viewbox>
</Button>
</Grid>
</Border>
<Border Grid.Column="1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<GroupBox Header="二值化">
<Grid>
<Grid.RowDefinitions>
<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>
</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 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.Row="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="Row" Foreground="White"></Label>
<TextBox Text="{Binding ShapeC_Min}" Background="Transparent" Foreground="White" Grid.Column="1" VerticalAlignment="Center"></TextBox>
<Label Content="Column" 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>
<Border Grid.Row="2" Grid.ColumnSpan="2">
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button Style="{DynamicResource commBtn}" Background="{Binding BorderBrush, ElementName=TAB1}" Margin="1" Command="{Binding LocationSettingCommand}">
<Viewbox>
<Label Foreground="White" Content="定位设置"></Label>
</Viewbox>
</Button>
<Button Grid.Column="1" Style="{DynamicResource commBtn}" Background="{Binding BorderBrush, ElementName=TAB1}" Command="{Binding ThresholdRunCommand}" Margin="1">
<Viewbox>
<Label Content="二值化预览" Foreground="White"></Label>
</Viewbox>
</Button>
<Button Grid.Row="3" Style="{DynamicResource commBtn}" Background="{Binding BorderBrush, ElementName=TAB1}" Margin="1" Command="{Binding LocationCheckCommand}">
<Viewbox>
<Label Foreground="White" Content="定位测试"></Label>
</Viewbox>
</Button>
<Button Grid.Row="3" Grid.Column="1" Style="{DynamicResource commBtn}" Background="{Binding BorderBrush, ElementName=TAB1}" Margin="1" Command="{Binding SaveInspectPerCommand}">
<Viewbox>
<Label Foreground="White" Content="保存"></Label>
</Viewbox>
</Button>
</Grid>
</Border>
</Grid>
</Border>
</Grid>
</GroupBox>
</UserControl>