From 32304b0a0a2e4af174c0feea96d2387bb75a2556 Mon Sep 17 00:00:00 2001
From: C3032 <caoxingqi@shlanbao.cn>
Date: 星期三, 18 三月 2026 16:03:44 +0800
Subject: [PATCH] 新增:读码器功能模块,集成华睿读码器并初步实现读码功能

---
 LB_SmartVision/ProcessRun/ProcessContext.cs |   71 ++++++++++++++++++-----------------
 1 files changed, 36 insertions(+), 35 deletions(-)

diff --git a/LB_SmartVision/ProcessRun/ProcessContext.cs b/LB_SmartVision/ProcessRun/ProcessContext.cs
index ff803a2..e46967c 100644
--- a/LB_SmartVision/ProcessRun/ProcessContext.cs
+++ b/LB_SmartVision/ProcessRun/ProcessContext.cs
@@ -9,6 +9,7 @@
 using LB_VisionProcesses.Processes.ScriptTool;
 using OpenCvSharp;
 using System.Collections.Concurrent;
+using System.Windows.Media.Media3D;
 
 namespace LB_SmartVision.ProcessRun
 {
@@ -301,7 +302,7 @@
             return res;
         }
 
-        public bool GetImage(Layout layout, out HImage InputImage, out HObject RecordImage)
+        public bool GetImage(Layout layout, out HObject InputImage, out HObject RecordImage)
         {
             InputImage = null; RecordImage = null;
             try
@@ -329,37 +330,24 @@
                     IndexValueName = arrOutputs[2];
 
                     object o_InputImage = ((IProcess)dicContext[IndexProcessName]).OutputImage;
-                    if (o_InputImage != null && o_InputImage is HImage ho_image && ho_image.IsInitialized())
-                    {
-                        InputImage = ho_image.Clone();
-                        ho_image.Dispose();
-                    }
-                    else if (o_InputImage != null && o_InputImage is Bitmap)
+                    if (o_InputImage is HObject ho_image && ho_image.IsInitialized())
+                        InputImage = ho_image;
+                    else if (o_InputImage is Bitmap)
                     {
                         //灏哅at杞崲涓篐Object
-                        using (HImage ho_RecordImage = TAlgorithm.Bitmap2HObject((Bitmap)o_InputImage))
-                        {
-                            if (ho_RecordImage != null)
-                            {
-                                InputImage = ho_RecordImage.Clone();
-                            }
-                        }
+                        TAlgorithm.Bitmap2HObject((Bitmap)o_InputImage, out HObject ho_RecordImage);
+                        InputImage = ho_RecordImage;
                     }
-                    else if (o_InputImage != null && o_InputImage is Mat)
+                    else if (o_InputImage is Mat)
                     {
                         //灏哅at杞崲涓篐Object
-                        using (HImage ho_RecordImage = TAlgorithm.Mat2HObject((Mat)o_InputImage))
-                        {
-                            if (ho_RecordImage != null)
-                            {
-                                InputImage = ho_RecordImage.Clone();
-                            }
-                        }
+                        TAlgorithm.Mat2HObject((Mat)o_InputImage, out HObject ho_RecordImage);
+                        InputImage = ho_RecordImage;
                     }
 
                     if (InputImage != null && InputImage.IsInitialized())
                     {
-                        InputImage.GetImageSize(out ho_ImageWidth, out ho_ImageHeight);
+                        HOperatorSet.GetImageSize(InputImage, out ho_ImageWidth, out ho_ImageHeight);
 
                         //鍥剧墖灏哄鍙樺寲鎵嶆洿鏂扮獥鍙e昂瀵竅鎻愰珮閫熷害]
                         if ((ho_ImageWidth.Length > 0 && ho_ImageWidth.TupleInt() != hWindowControl.Size.Width)
@@ -502,37 +490,36 @@
                 if (dicContext.TryGetValue(ProcessName, out IProcess obj)
                     && obj is IProcess process)
                 {
+                    //process.InputImage = null;
+
                     if (process.InputImage != null)
                     {
                         if (process.InputImage is HObject)
-                        {
                             ((HObject)process.InputImage).Dispose();
-                        }
                         else if (process.InputImage is Mat)
-                        {
                             ((Mat)process.InputImage).Dispose();
-                        }
                         else if (process.InputImage is Bitmap)
-                        {
                             ((Bitmap)process.InputImage).Dispose();
-                        }
+
                         process.InputImage = null;
                     }
+
                     if (process.OutputImage != null)
                     {
                         if (process.OutputImage is HObject)
-                        {
                             ((HObject)process.OutputImage).Dispose();
-                        }
                         else if (process.OutputImage is Mat)
-                        {
                             ((Mat)process.OutputImage).Dispose();
-                        }
                         else if (process.OutputImage is Bitmap)
-                        {
                             ((Bitmap)process.OutputImage).Dispose();
-                        }
+
                         process.OutputImage = null;
+                    }
+
+                    if (process.Record != null)
+                    {
+                        process.Record.Dispose();
+                        process.Record = null;
                     }
                     UpdateInputs(process);
 
@@ -583,9 +570,23 @@
         [Node("鐩告満鍙栧浘", "鍙栧儚宸ュ叿", "Basic", "鐩告満鍙栧浘")]
         public void 鐩告満鍙栧浘(FlowNode node) { RunNodeAsync(node); }
 
+        [Node("璇荤爜宸ュ叿", "鍙栧儚宸ュ叿", "Basic", "璇荤爜宸ュ叿")]
+        public void 璇荤爜宸ュ叿(FlowNode node) { RunNodeAsync(node); }
+
         [Node("Halcon2D鏂戠偣宸ュ叿", "Halcon2D宸ュ叿", "Basic", "Halcon2D鏂戠偣宸ュ叿")]
         public void Halcon2D鏂戠偣宸ュ叿(FlowNode node) { RunNodeAsync(node); }
 
+        [Node("閫氳妯″潡", "閫氳宸ュ叿", "Basic", "閫氳妯″潡")]
+        public void 閫氳妯″潡(FlowNode node) { RunNodeAsync(node); }
+
+        [Node("Halcon2D鍥惧儚澧炲己", "Halcon2D宸ュ叿", "Basic", "Halcon2D鍥惧儚澧炲己")]
+        public void Halcon2D鍥惧儚澧炲己(FlowNode node) { RunNodeAsync(node); }
+
+        [Node("Halcon2D鍥惧儚婊ゆ尝", "Halcon2D宸ュ叿", "Basic", "Halcon2D鍥惧儚婊ゆ尝")]
+        public void Halcon2D鍥惧儚婊ゆ尝(FlowNode node) { RunNodeAsync(node); }
+
+
+
         #endregion
 
 

--
Gitblit v1.9.3