diff --git a/PLCSharpWpf/Models/xfeat.onnx b/PLCSharpWpf/Models/xfeat.onnx deleted file mode 100644 index fab6b7f..0000000 Binary files a/PLCSharpWpf/Models/xfeat.onnx and /dev/null differ diff --git a/PLCSharpWpf/Models/xfeat.onnx.data b/PLCSharpWpf/Models/xfeat.onnx.data deleted file mode 100644 index 92650a3..0000000 Binary files a/PLCSharpWpf/Models/xfeat.onnx.data and /dev/null differ diff --git a/PLCSharpWpf/PLCSharp.csproj b/PLCSharpWpf/PLCSharp.csproj index 4ae4e7a..fd6a747 100644 --- a/PLCSharpWpf/PLCSharp.csproj +++ b/PLCSharpWpf/PLCSharp.csproj @@ -21,7 +21,6 @@ - @@ -38,12 +37,6 @@ Never - - PreserveNewest - - - PreserveNewest - PreserveNewest diff --git a/PLCSharpWpf/VVMs/Vision/VisionConfig.xaml b/PLCSharpWpf/VVMs/Vision/VisionConfig.xaml index a92634d..2a58e32 100644 --- a/PLCSharpWpf/VVMs/Vision/VisionConfig.xaml +++ b/PLCSharpWpf/VVMs/Vision/VisionConfig.xaml @@ -260,7 +260,8 @@ Header="功能类型" IsReadOnly="True" ItemsSource="{Binding Source={StaticResource FlowFromEnum}}" SelectedItemBinding="{Binding Type}" /> - + + diff --git a/PLCSharpWpf/VVMs/Vision/VisionConfigViewModel.Flows.cs b/PLCSharpWpf/VVMs/Vision/VisionConfigViewModel.Flows.cs index b816792..6865628 100644 --- a/PLCSharpWpf/VVMs/Vision/VisionConfigViewModel.Flows.cs +++ b/PLCSharpWpf/VVMs/Vision/VisionConfigViewModel.Flows.cs @@ -133,9 +133,6 @@ public partial class VisionConfigViewModel case VisionFlowType.SIFT匹配: ContentRegion = new SiftMatch(); break; - case VisionFlowType.XFeat匹配: - ContentRegion = new XFeatMatch(); - break; case VisionFlowType.矩阵生成: ContentRegion = new MatrixGen(); break; @@ -476,15 +473,6 @@ public partial class VisionConfigViewModel newFlow.BoolParams["SiftMatch_OutOffset"] = true; newFlow.BoolParams["SiftMatch_OutMat"] = true; break; - case VisionFlowType.XFeat匹配: - newFlow.DoubleParams["DetectThresh"] = 0.01; - newFlow.DoubleParams["MatchThresh"] = 0.6; - newFlow.IntParams["TopK"] = 4096; - newFlow.IntParams["MaxDim"] = 640; - newFlow.StringParams["TemplateName"] = "XFeat_Template"; - newFlow.StringParams["XFeatMatch_PosVar"] = "XFeat匹配_Pos"; - newFlow.StringParams["XFeatMatch_OffsetVar"] = "XFeat匹配_Offset"; - break; case VisionFlowType.矩阵生成: newFlow.DoubleParams["MoveX"] = 0; newFlow.DoubleParams["MoveY"] = 0; diff --git a/PLCSharpWpf/VVMs/Vision/VisionConfigViewModel.PublicCommands.cs b/PLCSharpWpf/VVMs/Vision/VisionConfigViewModel.PublicCommands.cs index ad21f68..2e3a0f4 100644 --- a/PLCSharpWpf/VVMs/Vision/VisionConfigViewModel.PublicCommands.cs +++ b/PLCSharpWpf/VVMs/Vision/VisionConfigViewModel.PublicCommands.cs @@ -757,56 +757,6 @@ public partial class VisionConfigViewModel } } - private AsyncDelegateCommand _DrawXFeatMatchROI; - public AsyncDelegateCommand DrawXFeatMatchROI => - _DrawXFeatMatchROI ??= new AsyncDelegateCommand(ExecuteDrawXFeatMatchROIAsync); - - private async Task ExecuteDrawXFeatMatchROIAsync() - { - var imageEdit = SelectedVisionFunction?.EditImageEdit; - if (imageEdit?.ImageSource == null) { SendInfoDialog("请先获取图片!"); return; } - try - { - if (SelectVisionFlow == null) return; - string roiShape = SelectVisionFlow.StringParams.TryGetValue("ROIShape", out var rs) - && !string.IsNullOrEmpty(rs) ? rs : "矩形"; - double centerX = 0, centerY = 0; - - switch (roiShape) - { - case "矩形": - { - var roi = await imageEdit.DrawROIAsync("XFeat匹配"); - if (roi == null) return; - SelectVisionFlow.DoubleParams["TemplateLeft"] = roi.Left; - SelectVisionFlow.DoubleParams["TemplateTop"] = roi.Top; - SelectVisionFlow.DoubleParams["TemplateWidth"] = roi.Width; - SelectVisionFlow.DoubleParams["TemplateHeight"] = roi.Height; - centerX = roi.Left + roi.Width / 2.0; - centerY = roi.Top + roi.Height / 2.0; - var srcMat = SelectedVisionFunction.Src; - if (srcMat != null && !srcMat.Empty()) - { - int x = Math.Clamp((int)roi.Left, 0, srcMat.Width - 1); - int y = Math.Clamp((int)roi.Top, 0, srcMat.Height - 1); - int w = Math.Min((int)roi.Width, srcMat.Width - x); - int h = Math.Min((int)roi.Height, srcMat.Height - y); - if (w > 0 && h > 0) - SaveTemplateMat(srcMat[new OpenCvSharp.Rect(x, y, w, h)].Clone()); - } - imageEdit.DrawRectVisual(roi.Left, roi.Top, roi.Width, roi.Height); - break; - } - } - SelectVisionFlow.DoubleParams["Width"] = imageEdit.ImageSource.Width; - SelectVisionFlow.DoubleParams["Height"] = imageEdit.ImageSource.Height; - SelectVisionFlow.DoubleParams["TemplateCenterX"] = centerX; - SelectVisionFlow.DoubleParams["TemplateCenterY"] = centerY; - SendInfoDialog("模板已保存"); - } - catch (Exception ex) { SendInfoDialog($"模板绘制失败:{ex.Message}"); } - } - /// /// 保存模板 Mat 到 Params(替换同名旧模板) /// diff --git a/PLCSharpWpf/VVMs/Vision/VisionFlow.cs b/PLCSharpWpf/VVMs/Vision/VisionFlow.cs index 5eec6bd..491a9d2 100644 --- a/PLCSharpWpf/VVMs/Vision/VisionFlow.cs +++ b/PLCSharpWpf/VVMs/Vision/VisionFlow.cs @@ -119,5 +119,17 @@ namespace PLCSharp.VVMs.Vision /// [JsonIgnore] public CameraBase? Camera { get; set; } + + private double _CT; + [JsonIgnore] + + /// + /// + /// + public double CT + { + get { return _CT; } + set { SetProperty(ref _CT, value); } + } } } diff --git a/PLCSharpWpf/VVMs/Vision/VisionFlowHandler/Algorithm/XFeatMatch.xaml b/PLCSharpWpf/VVMs/Vision/VisionFlowHandler/Algorithm/XFeatMatch.xaml deleted file mode 100644 index 44b6c08..0000000 --- a/PLCSharpWpf/VVMs/Vision/VisionFlowHandler/Algorithm/XFeatMatch.xaml +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - - - - - - - - - - - -