From 65509ea2a0808389a07a446f2df1cadb16d97dbc Mon Sep 17 00:00:00 2001
From: C3032 <C3032@BC3032>
Date: 星期二, 30 十二月 2025 16:36:05 +0800
Subject: [PATCH] Merge branch 'master' into feature/HR_Camera

---
 LB_SmartVision/ProcessRun/ProcessContext.cs |   69 ++++++----------------------------
 1 files changed, 13 insertions(+), 56 deletions(-)

diff --git a/LB_SmartVision/ProcessRun/ProcessContext.cs b/LB_SmartVision/ProcessRun/ProcessContext.cs
index ff803a2..6f32ad5 100644
--- a/LB_SmartVision/ProcessRun/ProcessContext.cs
+++ b/LB_SmartVision/ProcessRun/ProcessContext.cs
@@ -301,7 +301,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 +329,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,38 +489,7 @@
                 if (dicContext.TryGetValue(ProcessName, out IProcess obj)
                     && obj is IProcess process)
                 {
-                    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;
-                    }
+                    process.InputImage = null;
                     UpdateInputs(process);
 
                     // 涓嶅悓鑺傜偣璺宠繃鐨勬柟寮忎笉鍚�
@@ -583,9 +539,10 @@
         [Node("鐩告満鍙栧浘", "鍙栧儚宸ュ叿", "Basic", "鐩告満鍙栧浘")]
         public void 鐩告満鍙栧浘(FlowNode node) { RunNodeAsync(node); }
 
-        [Node("Halcon2D鏂戠偣宸ュ叿", "Halcon2D宸ュ叿", "Basic", "Halcon2D鏂戠偣宸ュ叿")]
+        [Node("Halcon2D鏂戠偣宸ュ叿", "Haclon2D宸ュ叿", "Basic", "Halcon2D鏂戠偣宸ュ叿")]
         public void Halcon2D鏂戠偣宸ュ叿(FlowNode node) { RunNodeAsync(node); }
 
+
         #endregion
 
 

--
Gitblit v1.9.3