清理TargetNullValue

This commit is contained in:
tfarcraw 2026-07-24 11:12:37 +08:00
parent cf00767804
commit bb3e687df9
17 changed files with 142 additions and 71 deletions

View File

@ -368,6 +368,7 @@ public partial class VisionConfigViewModel
newFlow.DoubleParams["RansacTh"] = 5;
newFlow.IntParams["CaliperLength"] = 100;
newFlow.IntParams["NumCalipers"] = 50;
newFlow.BoolParams["Caliper_OutOffset"] = true;
break;
case VisionFlowType.卡尺找圆:
newFlow.IntParams["Threshold"] = 30;

View File

@ -52,13 +52,13 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Text="边缘阈值" VerticalAlignment="Center" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[Threshold], Mode=TwoWay, =30}" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[Threshold], Mode=TwoWay}" />
<TextBlock Grid.Row="1" Text="卡尺长度" VerticalAlignment="Center" ToolTip="扫描线长度(像素)" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[CaliperLength], Mode=TwoWay, =100, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[CaliperLength], Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
<TextBlock Grid.Row="2" Text="卡尺数量" VerticalAlignment="Center" ToolTip="扫描线数量" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[NumCalipers], Mode=TwoWay, =10, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[NumCalipers], Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
<TextBlock Grid.Row="3" Text="方向" VerticalAlignment="Center" />
<ComboBox Grid.Row="3" Grid.Column="1" SelectedIndex="{Binding SelectVisionFlow.IntParams[Direction], Mode=TwoWay}">
@ -74,13 +74,13 @@
</ComboBox>
<TextBlock Grid.Row="5" Text="最小分数%" VerticalAlignment="Center" />
<TextBox Grid.Row="5" Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[MinScore], Mode=TwoWay, =10}" />
<TextBox Grid.Row="5" Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[MinScore], Mode=TwoWay}" />
<TextBlock Grid.Row="6" Text="RANSAC阈值" VerticalAlignment="Center" />
<TextBox Grid.Row="6" Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[RansacTh], Mode=TwoWay, =5, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Row="6" Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[RansacTh], Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
<TextBlock Grid.Row="7" Text="结果变量" VerticalAlignment="Center" />
<TextBox Grid.Row="7" Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[EdgeName], Mode=TwoWay, =卡尺寻边_Edge}" />
<TextBox Grid.Row="7" Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[EdgeName], Mode=TwoWay}" />
</Grid>
</GroupBox>
<GroupBox Header="模板">
@ -121,11 +121,35 @@
</Grid>
<Grid Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="75" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Text="偏移变量" VerticalAlignment="Center" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[LineOffsetVar], Mode=TwoWay, =找线_Offset}" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[LineOffsetVar], Mode=TwoWay}" />
<CheckBox Grid.Column="2" Margin="5,0,0,0" Content="输出" VerticalAlignment="Center"
IsChecked="{Binding SelectVisionFlow.BoolParams[Caliper_OutOffset], Mode=TwoWay}" />
</Grid>
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Text="坐标转换" VerticalAlignment="Center" />
<ComboBox Grid.Column="1" Margin="5,0"
ItemsSource="{Binding SystemVariables}"
SelectedValue="{Binding SelectVisionFlow.StringParams[Caliper_TransformMat], Mode=TwoWay}"
SelectedValuePath="Name" DisplayMemberPath="Name" />
<CheckBox Grid.Column="2" Content="启用" VerticalAlignment="Center"
IsChecked="{Binding SelectVisionFlow.BoolParams[Caliper_EnableTransform], Mode=TwoWay}" />
<TextBlock Grid.Row="1" Text="结果变量" VerticalAlignment="Center" />
<TextBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2"
Text="{Binding SelectVisionFlow.StringParams[Caliper_TransformOutVar], Mode=TwoWay}" />
</Grid>
</StackPanel>
</GroupBox>

View File

@ -176,13 +176,11 @@ namespace PLCSharp.VVMs.Vision.VisionFlowHandler.Algorithm
item.DoubleParams.TryGetValue("TemplateLineEndX", out double tex) &&
item.DoubleParams.TryGetValue("TemplateLineEndY", out double tey))
{
// 计算模板中心偏移
double cenX = (sx + ex) / 2, cenY = (sy + ey) / 2;
double tCenX = (tsx + tex) / 2, tCenY = (tsy + tey) / 2;
double offsetX = Math.Round(cenX - tCenX, 3);
double offsetY = Math.Round(cenY - tCenY, 3);
// 角度:统一用拟合线与首尾卡尺的交点
double tAngle = Math.Atan2(tey - tsy, tex - tsx);
var lineInls = new Line2D(inls[0].X, inls[0].Y, inls[^1].X, inls[^1].Y);
double fc = (0 + 0.5) / numCalipers;
@ -195,18 +193,66 @@ namespace PLCSharp.VVMs.Vision.VisionFlowHandler.Algorithm
var ce = Intersect(lineInls, caliperLast);
double cAngle = Math.Atan2(ce.Y - cs.Y, ce.X - cs.X);
double offsetAngle = Math.Round((cAngle - tAngle) * 180 / Math.PI, 3);
func.Params.ResultDoubles["LineOffsetX"] = offsetX;
func.Params.ResultDoubles["LineOffsetY"] = offsetY;
func.Params.ResultDoubles["LineOffsetAngle"] = offsetAngle;
var offVarName = item.StringParams.TryGetValue("LineOffsetVar", out var ov) && !string.IsNullOrEmpty(ov) ? ov : "找线_Offset";
var offVar = func.Params.Variables.FirstOrDefault(v => v.Name == offVarName);
if (offVar == null)
if (!item.BoolParams.TryGetValue("Caliper_OutOffset", out bool skipOff) || skipOff)
{
offVar = new LocalVariableItem(offVarName, "Pos", new Pos());
System.Windows.Application.Current.Dispatcher.Invoke(() => func.Params.Variables.Add(offVar));
var offVarName = item.StringParams.TryGetValue("LineOffsetVar", out var ov) && !string.IsNullOrEmpty(ov) ? ov : "找线_Offset";
var offVar = func.Params.Variables.FirstOrDefault(v => v.Name == offVarName);
if (offVar == null)
{
offVar = new LocalVariableItem(offVarName, "Pos", new Pos());
System.Windows.Application.Current.Dispatcher.Invoke(() => func.Params.Variables.Add(offVar));
}
offVar.RawValue = new Pos(offsetX, offsetY, 0, offsetAngle);
}
}
// 坐标转换
if (item.BoolParams.TryGetValue("Caliper_EnableTransform", out bool enableXf) && enableXf)
{
if (item.StringParams.TryGetValue("Caliper_TransformMat", out var xfName) && !string.IsNullOrEmpty(xfName))
{
var sysVar = func.GlobalModel.VariablesModel.SystemVariables.FirstOrDefault(v => v.Name == xfName);
if (sysVar?.Value != null)
{
using var xfMat = MatExtension.DeserializeAffineMat(sysVar.Value.ToString());
double xs = 1, ys = 1;
if (xfMat.Rows >= 2 && xfMat.Cols >= 2)
{
xs = Math.Sqrt(xfMat.At<double>(0, 0) * xfMat.At<double>(0, 0) + xfMat.At<double>(1, 0) * xfMat.At<double>(1, 0));
ys = Math.Sqrt(xfMat.At<double>(0, 1) * xfMat.At<double>(0, 1) + xfMat.At<double>(1, 1) * xfMat.At<double>(1, 1));
}
Point2f XfPoint(double px, double py)
{
if (xfMat.Rows == 2)
return new Point2f((float)(px * xfMat.At<double>(0, 0) + py * xfMat.At<double>(0, 1) + xfMat.At<double>(0, 2)),
(float)(px * xfMat.At<double>(1, 0) + py * xfMat.At<double>(1, 1) + xfMat.At<double>(1, 2)));
double w = px * xfMat.At<double>(2, 0) + py * xfMat.At<double>(2, 1) + xfMat.At<double>(2, 2);
if (Math.Abs(w) < 1e-10) return new Point2f(0, 0);
return new Point2f((float)((px * xfMat.At<double>(0, 0) + py * xfMat.At<double>(0, 1) + xfMat.At<double>(0, 2)) / w),
(float)((px * xfMat.At<double>(1, 0) + py * xfMat.At<double>(1, 1) + xfMat.At<double>(1, 2)) / w));
}
var lf = XfPoint(inls[0].X, inls[0].Y);
var lt = XfPoint(inls[^1].X, inls[^1].Y);
var outVarName = item.StringParams.TryGetValue("Caliper_TransformOutVar", out var tns) && !string.IsNullOrEmpty(tns) ? tns : "找线_转换";
var outVar = func.Params.Variables.FirstOrDefault(v => v.Name == outVarName);
if (outVar == null)
{
outVar = new LocalVariableItem(outVarName, "Line", new Line(new Pos(), new Pos()));
System.Windows.Application.Current.Dispatcher.Invoke(() => func.Params.Variables.Add(outVar));
}
outVar.RawValue = new Line(
new Pos(Math.Round(lf.X, 3), Math.Round(lf.Y, 3), 0, 0),
new Pos(Math.Round(lt.X, 3), Math.Round(lt.Y, 3), 0, 0));
}
}
offVar.RawValue = new Pos(offsetX, offsetY, 0, offsetAngle);
}
_ = func.RenderDrawAsync();
item.Flow.Done = true;

View File

@ -61,13 +61,13 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Text="边缘阈值" VerticalAlignment="Center" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[Threshold], Mode=TwoWay, =30}" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[Threshold], Mode=TwoWay}" />
<TextBlock Grid.Row="1" Text="卡尺长度" VerticalAlignment="Center" ToolTip="扫描线长度(像素)" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[CaliperLength], Mode=TwoWay, =100, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[CaliperLength], Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
<TextBlock Grid.Row="2" Text="卡尺数量" VerticalAlignment="Center" ToolTip="每条边均布的扫描线数量" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[NumCalipers], Mode=TwoWay, =50, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[NumCalipers], Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
<TextBlock Grid.Row="3" Text="方向" VerticalAlignment="Center" />
<ComboBox Grid.Row="3" Grid.Column="1" SelectedIndex="{Binding SelectVisionFlow.IntParams[Direction], Mode=TwoWay}">
@ -89,16 +89,16 @@
</ComboBox>
<TextBlock Grid.Row="6" Text="最小分数%" VerticalAlignment="Center" />
<TextBox Grid.Row="6" Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[MinScore], Mode=TwoWay, =10}" />
<TextBox Grid.Row="6" Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[MinScore], Mode=TwoWay}" />
<TextBlock Grid.Row="7" Text="RANSAC阈值" VerticalAlignment="Center" ToolTip="点到拟合边缘的距离阈值(像素)" />
<TextBox Grid.Row="7" Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[RansacTh], Mode=TwoWay, =5, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Row="7" Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[RansacTh], Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
<TextBlock Grid.Row="8" Text="最小内点数" VerticalAlignment="Center" />
<TextBox Grid.Row="8" Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[MinInliers], Mode=TwoWay, =10, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Row="8" Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[MinInliers], Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
<TextBlock Grid.Row="9" Text="结果变量" VerticalAlignment="Center" />
<TextBox Grid.Row="9" Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[RectResultVar], Mode=TwoWay, =卡尺找旋转矩形_Rect}" />
<TextBox Grid.Row="9" Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[RectResultVar], Mode=TwoWay}" />
<TextBlock Grid.Row="10" Text="内点数" VerticalAlignment="Center" />
<TextBox Grid.Row="10" Grid.Column="1"
@ -146,7 +146,7 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Text="偏移变量" VerticalAlignment="Center" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[RectOffsetVar], Mode=TwoWay, =找矩形_Offset}" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[RectOffsetVar], Mode=TwoWay}" />
</Grid>
</StackPanel>
</GroupBox>

View File

@ -57,19 +57,19 @@
<!-- H -->
<TextBlock Text="H 最小值" VerticalAlignment="Center" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[HMin], =0, UpdateSourceTrigger=PropertyChanged}" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[HMin], UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Grid.Column="2" Text="H 最大值" VerticalAlignment="Center" />
<TextBox Grid.Column="3" Text="{Binding SelectVisionFlow.IntParams[HMax], =180, UpdateSourceTrigger=PropertyChanged}" />
<TextBox Grid.Column="3" Text="{Binding SelectVisionFlow.IntParams[HMax], UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Grid.Row="1" Text="S 最小值" VerticalAlignment="Center" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[SMin], =0, UpdateSourceTrigger=PropertyChanged}" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[SMin], UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Grid.Row="1" Grid.Column="2" Text="S 最大值" VerticalAlignment="Center" />
<TextBox Grid.Row="1" Grid.Column="3" Text="{Binding SelectVisionFlow.IntParams[SMax], =255, UpdateSourceTrigger=PropertyChanged}" />
<TextBox Grid.Row="1" Grid.Column="3" Text="{Binding SelectVisionFlow.IntParams[SMax], UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Grid.Row="2" Text="V 最小值" VerticalAlignment="Center" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[VMin], =0, UpdateSourceTrigger=PropertyChanged}" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[VMin], UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Grid.Row="2" Grid.Column="2" Text="V 最大值" VerticalAlignment="Center" />
<TextBox Grid.Row="2" Grid.Column="3" Text="{Binding SelectVisionFlow.IntParams[VMax], =255, UpdateSourceTrigger=PropertyChanged}" />
<TextBox Grid.Row="2" Grid.Column="3" Text="{Binding SelectVisionFlow.IntParams[VMax], UpdateSourceTrigger=PropertyChanged}" />
</Grid>
</GroupBox>
@ -86,10 +86,10 @@
</Grid.ColumnDefinitions>
<TextBlock Text="下限 %" VerticalAlignment="Center" ToolTip="颜色面积占比低于此值判定为 NG" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[AreaMinPercent], =0, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[AreaMinPercent], UpdateSourceTrigger=LostFocus}" />
<TextBlock Grid.Row="1" Text="上限 %" VerticalAlignment="Center" ToolTip="颜色面积占比高于此值判定为 NG" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[AreaMaxPercent], =100, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[AreaMaxPercent], UpdateSourceTrigger=LostFocus}" />
</Grid>
</GroupBox>

View File

@ -54,10 +54,10 @@
</Grid.ColumnDefinitions>
<TextBlock Text="最小值" VerticalAlignment="Center" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[GrayMin], =0, UpdateSourceTrigger=PropertyChanged}" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[GrayMin], UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Grid.Column="2" Text="最大值" VerticalAlignment="Center" />
<TextBox Grid.Column="3" Text="{Binding SelectVisionFlow.IntParams[GrayMax], =255, UpdateSourceTrigger=PropertyChanged}" />
<TextBox Grid.Column="3" Text="{Binding SelectVisionFlow.IntParams[GrayMax], UpdateSourceTrigger=PropertyChanged}" />
</Grid>
</GroupBox>
@ -74,10 +74,10 @@
</Grid.ColumnDefinitions>
<TextBlock Text="下限 %" VerticalAlignment="Center" ToolTip="灰度面积占比低于此值判定为 NG" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[AreaMinPercent], =0, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[AreaMinPercent], UpdateSourceTrigger=LostFocus}" />
<TextBlock Grid.Row="1" Text="上限 %" VerticalAlignment="Center" ToolTip="灰度面积占比高于此值判定为 NG" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[AreaMaxPercent], =100, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[AreaMaxPercent], UpdateSourceTrigger=LostFocus}" />
</Grid>
</GroupBox>

View File

@ -20,7 +20,7 @@
</Grid.ColumnDefinitions>
<TextBlock Text="ROI 形状" VerticalAlignment="Center" />
<ComboBox Grid.Column="1" Margin="5,0,0,0"
SelectedValue="{Binding SelectVisionFlow.StringParams[ROIShape], =矩形}"
SelectedValue="{Binding SelectVisionFlow.StringParams[ROIShape]}"
SelectedValuePath="Content">
<ComboBoxItem Content="矩形" IsSelected="True" />
<ComboBoxItem Content="旋转矩形" />
@ -49,7 +49,7 @@
<TextBlock Grid.Row="1" Grid.Column="2" Margin="5,0" Text="高度" VerticalAlignment="Center" />
<TextBox Grid.Row="1" Grid.Column="3" Text="{Binding SelectVisionFlow.DoubleParams[TemplateHeight], UpdateSourceTrigger=LostFocus}" />
<TextBlock Grid.Row="2" Text="模板名称" VerticalAlignment="Center" />
<TextBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding SelectVisionFlow.StringParams[TemplateName], Mode=TwoWay, =GrayMatch_Template}" />
<TextBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding SelectVisionFlow.StringParams[TemplateName], Mode=TwoWay}" />
</Grid>
</StackPanel>
</GroupBox>
@ -72,16 +72,16 @@
</Grid.ColumnDefinitions>
<TextBlock Text="最小角度" VerticalAlignment="Center" ToolTip="角度搜索起始值(度)" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[MinAngle], Mode=TwoWay, =-10, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[MinAngle], Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
<TextBlock Grid.Row="1" Text="最大角度" VerticalAlignment="Center" ToolTip="角度搜索终止值(度)" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[MaxAngle], Mode=TwoWay, =10, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[MaxAngle], Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
<TextBlock Grid.Row="2" Text="角度步长" VerticalAlignment="Center" ToolTip="生成模板的角度步长(度)。越小精度越高但预处理越慢" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[AngleStep], Mode=TwoWay, =1, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[AngleStep], Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
<TextBlock Grid.Row="3" Text="分数下限" VerticalAlignment="Center" ToolTip="CCorrNormed 分数下限(-1~1)。越高匹配越好,低于此值则拒绝" />
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[MatchScoreMax], Mode=TwoWay, =0.5, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[MatchScoreMax], Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
</Grid>
</StackPanel>
</GroupBox>
@ -94,7 +94,7 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Text="位置变量" VerticalAlignment="Center" ToolTip="匹配到的位置 (X,Y,角度) 写入此 Pos 变量" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[GrayTemplateMatch_PosVar], Mode=TwoWay, =灰度模板匹配_Pos}" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[GrayTemplateMatch_PosVar], Mode=TwoWay}" />
</Grid>
</GroupBox>

View File

@ -21,13 +21,13 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Text="X 平移" VerticalAlignment="Center" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[MoveX], Mode=TwoWay, =0, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[MoveX], Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
<TextBlock Grid.Row="1" Text="Y 平移" VerticalAlignment="Center" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[MoveY], Mode=TwoWay, =0, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[MoveY], Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
<TextBlock Grid.Row="2" Text="角度" VerticalAlignment="Center" ToolTip="旋转角度(度)" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[Angle], Mode=TwoWay, =0, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[Angle], Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
</Grid>
</GroupBox>
<GroupBox Header="输出变量">
@ -37,7 +37,7 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Text="矩阵变量名" VerticalAlignment="Center" ToolTip="写入局部变量表的 String 变量名" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[MatrixVar], Mode=TwoWay, =生成矩阵, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[MatrixVar], Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
</Grid>
</GroupBox>
</StackPanel>

View File

@ -18,7 +18,7 @@
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="ROI 形状" VerticalAlignment="Center" />
<ComboBox Grid.Column="1" Margin="5,0,0,0" SelectedValue="{Binding SelectVisionFlow.StringParams[ROIShape], =矩形}" SelectedValuePath="Content">
<ComboBox Grid.Column="1" Margin="5,0,0,0" SelectedValue="{Binding SelectVisionFlow.StringParams[ROIShape]}" SelectedValuePath="Content">
<ComboBoxItem Content="矩形" IsSelected="True" />
<ComboBoxItem Content="旋转矩形" />
<ComboBoxItem Content="圆形" />
@ -55,7 +55,7 @@
<TextBox Grid.Row="1" Grid.Column="3" Text="{Binding SelectVisionFlow.DoubleParams[TemplateHeight], UpdateSourceTrigger=LostFocus}" />
<TextBlock Grid.Row="2" Text="模板名称" VerticalAlignment="Center" />
<TextBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding SelectVisionFlow.StringParams[TemplateName], Mode=TwoWay, =ORB_Template}" />
<TextBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding SelectVisionFlow.StringParams[TemplateName], Mode=TwoWay}" />
</Grid>
</StackPanel>
</GroupBox>
@ -73,13 +73,13 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Text="特征点数量" VerticalAlignment="Center" ToolTip="提取的特征点越多越精确,但速度越慢" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[NFeatures], Mode=TwoWay, =1000, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[NFeatures], Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
<TextBlock Grid.Row="1" Text="最小匹配数" VerticalAlignment="Center" ToolTip="最少需要的优质匹配点数" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[MinMatches], Mode=TwoWay, =8, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[MinMatches], Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
<TextBlock Grid.Row="2" Text="优质匹配比例" VerticalAlignment="Center" ToolTip="匹配距离 &lt; 最小距离×此系数的视为优质匹配" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[MinGoodRatio], Mode=TwoWay, =0.3, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[MinGoodRatio], Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
</Grid>
</GroupBox>
@ -94,10 +94,10 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Text="绝对位置变量" VerticalAlignment="Center" ToolTip="匹配到的绝对位置写入此 Pos 变量" />
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[ORBMatch_PosVar], Mode=TwoWay, =ORB匹配_Pos}" />
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[ORBMatch_PosVar], Mode=TwoWay}" />
<TextBlock Grid.Row="1" Text="相对位移变量" VerticalAlignment="Center" ToolTip="相对位移写入此 Pos 变量" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[ORBMatch_OffsetVar], Mode=TwoWay, =ORB匹配_Offset}" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[ORBMatch_OffsetVar], Mode=TwoWay}" />
</Grid>
</GroupBox>

View File

@ -34,7 +34,7 @@
SelectedValue="{Binding SelectVisionFlow.StringParams[LineVar], Mode=TwoWay}"
SelectedValuePath="Name" DisplayMemberPath="Name" />
<TextBlock Grid.Row="2" Text="结果变量" VerticalAlignment="Center" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[ResultVar], Mode=TwoWay, =点到线距离}" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[ResultVar], Mode=TwoWay}" />
<TextBlock Grid.Row="3" Text="距离" VerticalAlignment="Center" />
<TextBox Grid.Row="3" Grid.Column="1"
Text="{Binding SelectedVisionFunction.Params.ResultDoubles[PointLineDist_Distance], Mode=OneWay}"

View File

@ -35,7 +35,7 @@
SelectedValue="{Binding SelectVisionFlow.StringParams[Point2Var], Mode=TwoWay}"
SelectedValuePath="Name" DisplayMemberPath="Name" />
<TextBlock Grid.Row="2" Text="结果变量" VerticalAlignment="Center" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[ResultVar], Mode=TwoWay, =点到点距离}" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[ResultVar], Mode=TwoWay}" />
<TextBlock Grid.Row="3" Text="距离" VerticalAlignment="Center" />
<TextBox Grid.Row="3" Grid.Column="1"
Text="{Binding SelectedVisionFunction.Params.ResultDoubles[PointDist_Distance], Mode=OneWay}"

View File

@ -18,7 +18,7 @@
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="ROI 形状" VerticalAlignment="Center" />
<ComboBox Grid.Column="1" Margin="5,0,0,0" SelectedValue="{Binding SelectVisionFlow.StringParams[ROIShape], =矩形}" SelectedValuePath="Content">
<ComboBox Grid.Column="1" Margin="5,0,0,0" SelectedValue="{Binding SelectVisionFlow.StringParams[ROIShape]}" SelectedValuePath="Content">
<ComboBoxItem Content="矩形" IsSelected="True" />
<ComboBoxItem Content="旋转矩形" />
<ComboBoxItem Content="圆形" />
@ -54,7 +54,7 @@
<TextBox Grid.Row="1" Grid.Column="3" Text="{Binding SelectVisionFlow.DoubleParams[TemplateHeight], UpdateSourceTrigger=LostFocus}" />
<TextBlock Grid.Row="2" Text="模板名称" VerticalAlignment="Center" />
<TextBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding SelectVisionFlow.StringParams[TemplateName], Mode=TwoWay, =SIFT_Template}" />
<TextBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding SelectVisionFlow.StringParams[TemplateName], Mode=TwoWay}" />
</Grid>
</StackPanel>
</GroupBox>
@ -71,13 +71,13 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Text="特征点数量" VerticalAlignment="Center" ToolTip="提取的特征点越多越精确,但速度越慢" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[NFeatures], Mode=TwoWay, =1000, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[NFeatures], Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
<TextBlock Grid.Row="1" Text="最小匹配数" VerticalAlignment="Center" ToolTip="最少需要的优质匹配点数" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[MinMatches], Mode=TwoWay, =8, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[MinMatches], Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
<TextBlock Grid.Row="2" Text="优质匹配比例" VerticalAlignment="Center" ToolTip="匹配距离 &lt; 最小距离×此系数的视为优质匹配" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[MinGoodRatio], Mode=TwoWay, =0.3, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[MinGoodRatio], Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
</Grid>
</GroupBox>
@ -94,21 +94,21 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Text="绝对位置变量" VerticalAlignment="Center" ToolTip="匹配到的绝对位置写入此 Pos 变量" />
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[SiftMatch_PosVar], Mode=TwoWay, =SIFT匹配_Pos}" />
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[SiftMatch_PosVar], Mode=TwoWay}" />
<CheckBox Grid.Row="0" Grid.Column="2"
Margin="5,0"
VerticalAlignment="Center"
IsChecked="{Binding SelectVisionFlow.BoolParams[SiftMatch_OutPos]}" />
<TextBlock Grid.Row="1" Text="相对位移变量" VerticalAlignment="Center" ToolTip="相对位移写入此 Pos 变量" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[SiftMatch_OffsetVar], Mode=TwoWay, =SIFT匹配_Offset}" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[SiftMatch_OffsetVar], Mode=TwoWay}" />
<CheckBox Grid.Row="1" Grid.Column="2"
Margin="5,0"
VerticalAlignment="Center"
IsChecked="{Binding SelectVisionFlow.BoolParams[SiftMatch_OutOffset]}" />
<TextBlock Grid.Row="2" Text="变换矩阵变量" VerticalAlignment="Center" ToolTip="变换矩阵写入此 String 变量" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[SiftMatch_MatVar], Mode=TwoWay, =SIFT匹配_矩阵}" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[SiftMatch_MatVar], Mode=TwoWay}" />
<CheckBox Grid.Row="2" Grid.Column="2"
Margin="5,0"
VerticalAlignment="Center"

View File

@ -35,7 +35,7 @@
SelectedValue="{Binding SelectVisionFlow.StringParams[Line2Var], Mode=TwoWay}"
SelectedValuePath="Name" DisplayMemberPath="Name" />
<TextBlock Grid.Row="2" Text="结果变量" VerticalAlignment="Center" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[IntersectResultVar], Mode=TwoWay, =两线交点}" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[IntersectResultVar], Mode=TwoWay}" />
<TextBlock Grid.Row="3" Text="交点X" VerticalAlignment="Center" />
<TextBox Grid.Row="3" Grid.Column="1"
Text="{Binding SelectedVisionFunction.Params.ResultDoubles[IntersectX], Mode=OneWay}"
@ -105,7 +105,7 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Text="偏移变量" VerticalAlignment="Center" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[IntersectOffsetVar], Mode=TwoWay, =两线交点_Offset}" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[IntersectOffsetVar], Mode=TwoWay}" />
</Grid>
</StackPanel>
</GroupBox>

View File

@ -32,7 +32,7 @@
</Grid.ColumnDefinitions>
<TextBlock Text="结果变量名" VerticalAlignment="Center" />
<TextBox Grid.Column="1"
Text="{Binding SelectVisionFlow.StringParams[ResultVarName], Mode=TwoWay, =微信解码_Result, UpdateSourceTrigger=LostFocus}" />
Text="{Binding SelectVisionFlow.StringParams[ResultVarName], Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
</Grid>
</GroupBox>

View File

@ -34,10 +34,10 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Text="裁剪限制" VerticalAlignment="Center" ToolTip="对比度限制,越大越强" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[ClipLimit], Mode=TwoWay, =2.0, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[ClipLimit], Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
<TextBlock Grid.Row="1" Text="网格大小" VerticalAlignment="Center" ToolTip="CLAHE 分块大小 (px)" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[TileSize], Mode=TwoWay, =8, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SelectVisionFlow.IntParams[TileSize], Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
</Grid>
</GroupBox>
</StackPanel>

View File

@ -22,7 +22,7 @@
</Grid.ColumnDefinitions>
<TextBlock Text="角度" VerticalAlignment="Center" ToolTip="旋转角度(度),正数逆时针,负数顺时针" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[RotateAngle], =0, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.DoubleParams[RotateAngle], UpdateSourceTrigger=LostFocus}" />
<TextBlock Grid.Row="1" Text="尺寸模式" VerticalAlignment="Center" />
<ComboBox Grid.Row="1" Grid.Column="1" SelectedIndex="{Binding SelectVisionFlow.IntParams[ResizeMode], Mode=TwoWay}">

View File

@ -16,7 +16,7 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Text="矩阵变量名" VerticalAlignment="Center" ToolTip="从局部变量表中读取 String 类型的矩阵变量" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[MatrixVar], Mode=TwoWay, =SIFT匹配_矩阵, UpdateSourceTrigger=LostFocus}" />
<TextBox Grid.Column="1" Text="{Binding SelectVisionFlow.StringParams[MatrixVar], Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
</Grid>
</GroupBox>
</StackPanel>