From 27e3ee67dfe0c7aea11d50dadcd3f41755858ced Mon Sep 17 00:00:00 2001 From: tfarcraw <123211521@163.com> Date: Thu, 23 Jul 2026 02:28:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E5=83=8F=E6=A0=A1=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PLCSharpWpf/Core/Common/FlowModel.cs | 4 +- PLCSharpWpf/GlobalSuppressions.cs | 2 +- .../Vision/VisionConfigViewModel.Flows.cs | 17 +++++- .../VisionFlowHandler/Access/ImageToFile.xaml | 2 +- .../Access/ImageToFileHandler.cs | 28 +++++++-- .../Algorithm/CaliperFindCircleHandler.cs | 6 +- .../Algorithm/CaliperFindEdgeHandler.cs | 6 +- .../Algorithm/GrayTemplateMatchHandler.cs | 4 +- .../Algorithm/MatrixGen.xaml | 45 ++++++++++++++ .../Algorithm/MatrixGen.xaml.cs | 12 ++++ .../Algorithm/MatrixGenHandler.cs | 43 ++++++++++++++ .../Algorithm/ORBMatchHandler.cs | 2 +- .../Algorithm/SiftMatch.xaml | 55 ++++++++++++----- .../Algorithm/SiftMatchHandler.cs | 4 +- .../Algorithm/XFeatMatchHandler.cs | 22 +++---- .../Processing/HistogramEqualizeHandler.cs | 4 +- .../Processing/ImageSubtractHandler.cs | 8 +-- .../Processing/ImageWarp.xaml | 24 ++++++++ .../Processing/ImageWarp.xaml.cs | 12 ++++ .../Processing/ImageWarpHandler.cs | 59 +++++++++++++++++++ PLCSharpWpf/VVMs/Vision/VisionFunction.cs | 9 ++- PLCSharpWpf/VVMs/Vision/VisionType.cs | 6 ++ 22 files changed, 318 insertions(+), 56 deletions(-) create mode 100644 PLCSharpWpf/VVMs/Vision/VisionFlowHandler/Algorithm/MatrixGen.xaml create mode 100644 PLCSharpWpf/VVMs/Vision/VisionFlowHandler/Algorithm/MatrixGen.xaml.cs create mode 100644 PLCSharpWpf/VVMs/Vision/VisionFlowHandler/Algorithm/MatrixGenHandler.cs create mode 100644 PLCSharpWpf/VVMs/Vision/VisionFlowHandler/Processing/ImageWarp.xaml create mode 100644 PLCSharpWpf/VVMs/Vision/VisionFlowHandler/Processing/ImageWarp.xaml.cs create mode 100644 PLCSharpWpf/VVMs/Vision/VisionFlowHandler/Processing/ImageWarpHandler.cs diff --git a/PLCSharpWpf/Core/Common/FlowModel.cs b/PLCSharpWpf/Core/Common/FlowModel.cs index b760d5c..7715cbd 100644 --- a/PLCSharpWpf/Core/Common/FlowModel.cs +++ b/PLCSharpWpf/Core/Common/FlowModel.cs @@ -43,7 +43,7 @@ /// /// 失败原因(非空表示异常结束) /// - public string? ErrorState { get; set; } + public string? FailMessage { get; set; } /// /// 单个步骤超时时间(秒),默认 5 秒 /// @@ -64,7 +64,7 @@ { Done = false; IsSuccess = false; - ErrorState = null; + FailMessage = null; Step = 0; StepTime = DateTime.Now; FlowStarTime = DateTime.Now; diff --git a/PLCSharpWpf/GlobalSuppressions.cs b/PLCSharpWpf/GlobalSuppressions.cs index b779936..1e5f099 100644 --- a/PLCSharpWpf/GlobalSuppressions.cs +++ b/PLCSharpWpf/GlobalSuppressions.cs @@ -10,4 +10,4 @@ using System.Diagnostics.CodeAnalysis; [assembly: SuppressMessage("Style", "IDE0305:简化集合初始化")] [assembly: SuppressMessage("Usage", "VSTHRD003:Avoid awaiting foreign Tasks")] [assembly: SuppressMessage("Usage", "VSTHRD001:Avoid legacy thread switching APIs")] - \ No newline at end of file +[assembly: SuppressMessage("Usage", "VSTHRD002:Avoid problematic synchronous waits")] diff --git a/PLCSharpWpf/VVMs/Vision/VisionConfigViewModel.Flows.cs b/PLCSharpWpf/VVMs/Vision/VisionConfigViewModel.Flows.cs index 71223fe..b816792 100644 --- a/PLCSharpWpf/VVMs/Vision/VisionConfigViewModel.Flows.cs +++ b/PLCSharpWpf/VVMs/Vision/VisionConfigViewModel.Flows.cs @@ -50,6 +50,9 @@ public partial class VisionConfigViewModel case VisionFlowType.图像相减: ContentRegion = new ImageFromLocal(); break; + case VisionFlowType.图像校正: + ContentRegion = new ImageWarp(); + break; case VisionFlowType.从局部图像获取图片: case VisionFlowType.存到局部图像: ContentRegion = new ImageFromLocal(); @@ -133,6 +136,9 @@ public partial class VisionConfigViewModel case VisionFlowType.XFeat匹配: ContentRegion = new XFeatMatch(); break; + case VisionFlowType.矩阵生成: + ContentRegion = new MatrixGen(); + break; case VisionFlowType.点到点距离: ContentRegion = new PointToPointDistance(); break; @@ -416,7 +422,10 @@ public partial class VisionConfigViewModel newFlow.IntParams["TileSize"] = 8; break; case VisionFlowType.图像相减: - + + break; + case VisionFlowType.图像校正: + newFlow.StringParams["MatrixVar"] = "SIFT匹配_矩阵"; break; case VisionFlowType.ROI解码: newFlow.IntParams["DecodeType"] = 0; @@ -476,6 +485,12 @@ public partial class VisionConfigViewModel newFlow.StringParams["XFeatMatch_PosVar"] = "XFeat匹配_Pos"; newFlow.StringParams["XFeatMatch_OffsetVar"] = "XFeat匹配_Offset"; break; + case VisionFlowType.矩阵生成: + newFlow.DoubleParams["MoveX"] = 0; + newFlow.DoubleParams["MoveY"] = 0; + newFlow.DoubleParams["Angle"] = 0; + newFlow.StringParams["MatrixVar"] = "生成矩阵"; + break; case VisionFlowType.点到点距离: newFlow.StringParams["ResultVar"] = "点到点距离"; break; diff --git a/PLCSharpWpf/VVMs/Vision/VisionFlowHandler/Access/ImageToFile.xaml b/PLCSharpWpf/VVMs/Vision/VisionFlowHandler/Access/ImageToFile.xaml index e5833fd..4b00466 100644 --- a/PLCSharpWpf/VVMs/Vision/VisionFlowHandler/Access/ImageToFile.xaml +++ b/PLCSharpWpf/VVMs/Vision/VisionFlowHandler/Access/ImageToFile.xaml @@ -11,6 +11,6 @@