From 6e5555994d7bca16ddba2726133a0ab99f1b6c31 Mon Sep 17 00:00:00 2001 From: sophelper <123211521@163.com> Date: Tue, 3 Nov 2026 01:21:58 +0800 Subject: [PATCH] =?UTF-8?q?feat(App):=20SOP=20=E9=A1=B5=20=E2=80=94=20?= =?UTF-8?q?=E7=94=BB=E9=9D=A2+ROI=20=E8=A6=86=E7=9B=96=E5=B1=82=20+=20?= =?UTF-8?q?=E6=AD=A5=E9=AA=A4=E5=8D=A1=20+=20Top3=20=E8=BF=9D=E8=A7=84=20+?= =?UTF-8?q?=20=E6=97=A5=E5=BF=97=20+=20=E8=BF=90=E8=A1=8C=E6=8E=A7?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ViewModel 构造注入引擎三件套,需在 RegisterTypes 显式注册(反射扫描只覆盖本程序集) - 帧 Mat 只在采集线程事件存活期内有效,必须当场克隆再交给渲染定时器 - ROI 覆盖层用 Viewbox 内层 Grid = 帧像素尺寸,配方坐标天然对齐 - WritePixels 的 rect 是(宽,高),与 OpenCvSharp 的 Rows/Cols 相反 - 纯 WPF 样式,无 HandyControl / SkiaSharp.Views.WPF --- src/SopHelper.App/App.xaml.cs | 13 + src/SopHelper.App/VVMs/SopPage/SopPage.xaml | 266 +++++++- .../VVMs/SopPage/SopPageViewModel.cs | 589 +++++++++++++++++- 3 files changed, 852 insertions(+), 16 deletions(-) diff --git a/src/SopHelper.App/App.xaml.cs b/src/SopHelper.App/App.xaml.cs index 58b6896..afc1148 100644 --- a/src/SopHelper.App/App.xaml.cs +++ b/src/SopHelper.App/App.xaml.cs @@ -5,7 +5,11 @@ using System.Windows.Threading; using Prism.Ioc; using Prism.Mvvm; using SopHelper.Core.Prism; +using SopHelper.Engine.Camera; +using SopHelper.Engine.Pipeline; +using SopHelper.Engine.Sop; using SopHelper.Models; +using SopHelper.VVMs.SopPage; using SopHelper.VVMs.MainWindow; namespace SopHelper; @@ -39,6 +43,15 @@ public partial class App } _ = containerRegistry.RegisterSingleton(); + + // 引擎层三件套。它们在 SopHelper.Engine 程序集里,上面的 [Model] 反射扫描只覆盖本程序集, + // 所以必须显式注册,否则 SOP 页 ViewModel 的构造注入解析不出来。 + _ = containerRegistry.RegisterSingleton(); + _ = containerRegistry.RegisterSingleton(); + _ = containerRegistry.RegisterSingleton(); + + // ViewModel 工厂默认走容器解析,带构造注入的 ViewModel 必须先注册 + _ = containerRegistry.Register(); } /// diff --git a/src/SopHelper.App/VVMs/SopPage/SopPage.xaml b/src/SopHelper.App/VVMs/SopPage/SopPage.xaml index 96a901b..e3c8b73 100644 --- a/src/SopHelper.App/VVMs/SopPage/SopPage.xaml +++ b/src/SopHelper.App/VVMs/SopPage/SopPage.xaml @@ -2,13 +2,263 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:prism="http://prismlibrary.com/" - prism:ViewModelLocator.AutoWireViewModel="True"> + prism:ViewModelLocator.AutoWireViewModel="True" + Background="{StaticResource Bg}"> - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +