From fec341de45f4b3fd1825807f0b3261143fa13caa Mon Sep 17 00:00:00 2001
From: C3204 <zhengyabo@lanpucloud.cn>
Date: 星期一, 29 十二月 2025 17:03:45 +0800
Subject: [PATCH] 修复部分显示工具为面向对象。

---
 LB_SmartVision/VisionForm.cs                                                           |    2 
 LB_VisionProcesses/Alogrithms/OpenCvSharp/BlobTool/BlobToolEdit.cs                     |    6 
 LB_SmartVision/Forms/Pages/ProcessPage/ProcessPage.cs                                  |    4 
 LB_VisionProcesses/Alogrithms/OpenCvSharp/FindLineTool/FindLineToolEdit.cs             |    8 
 LB_VisionProcesses/Alogrithms/Halcon/2D/HFindCode2dTool/HFindCode2dToolEdit.cs         |   18 ++-
 LB_VisionProcesses/Alogrithms/Halcon/2D/HFindLineTool/HFindLineToolEdit.cs             |   27 ++++-
 LB_VisionProcesses/Alogrithms/Halcon/2D/HFindMultiModelTool/HFindMultiModelToolEdit.cs |   20 ++-
 LB_VisionControl/UserHSmartWindowControl.cs                                            |   30 +++---
 LB_VisionProcesses/Alogrithms/Halcon/2D/HBlobTool/HBlobToolEdit.cs                     |   14 +-
 LB_VisionProcesses/Alogrithms/Halcon/2D/HFindModelTool/HFindModelToolEdit.cs           |   34 ++++--
 LB_VisionProcesses/Alogrithms/BaseAlgorithm/TAlgorithmEdit.cs                          |    8 
 LB_SmartVision/ProcessRun/ProcessRunBll.cs                                             |    4 
 LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.cs                               |    8 
 LB_VisionProcesses/Alogrithms/BaseAlgorithm/TestTool/TestToolEdit.cs                   |   10 +-
 LB_VisionProcesses/Alogrithms/OpenCvSharp/FindModelTool/FindModelToolEdit.cs           |   16 +-
 LB_SmartVision/ProcessRun/ProcessContext.cs                                            |   48 +++++----
 LB_VisionProcesses/Alogrithms/BaseAlgorithm/TAlgorithm.cs                              |    8 
 LB_SmartVision/Forms/Pages/ProcessPage/AllProcessesPage.cs                             |    4 
 18 files changed, 160 insertions(+), 109 deletions(-)

diff --git a/LB_SmartVision/Forms/Pages/ProcessPage/AllProcessesPage.cs b/LB_SmartVision/Forms/Pages/ProcessPage/AllProcessesPage.cs
index 2b2ff11..ebe3011 100644
--- a/LB_SmartVision/Forms/Pages/ProcessPage/AllProcessesPage.cs
+++ b/LB_SmartVision/Forms/Pages/ProcessPage/AllProcessesPage.cs
@@ -79,7 +79,7 @@
                             , this.controlsPanel.Size.Height-40);
                         processControl.Location
                             = new Point(processControl.Size.Width * index, 0);
-                        if (GlobalVar.dicProcesses[name].GetImage(GlobalVar.dicLayout[i], out _, out HObject RecordImage))
+                        if (GlobalVar.dicProcesses[name].GetImage(GlobalVar.dicLayout[i], out _, out HImage RecordImage))
                         {
                             dicProcessControls[title].ShowHoImage(RecordImage);
                         }
@@ -97,7 +97,7 @@
                         dicProcessControls.TryAdd(title, processControl);
                         this.controlsPanel.Controls.Add(processControl);
 
-                        if (GlobalVar.dicProcesses[name].GetImage(GlobalVar.dicLayout[i], out _, out HObject RecordImage))
+                        if (GlobalVar.dicProcesses[name].GetImage(GlobalVar.dicLayout[i], out _, out HImage RecordImage))
                         {
                             dicProcessControls[title].ShowHoImage(RecordImage);
                         }
diff --git a/LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.cs b/LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.cs
index a3e21fd..ee4545a 100644
--- a/LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.cs
+++ b/LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.cs
@@ -81,10 +81,10 @@
         /// 寮傛鏄剧ず鍥剧墖
         /// </summary>
         /// <param name="ho_image"></param>
-        public void ShowHoImage(HObject ho_image)
+        public void ShowHoImage(HImage ho_image)
         {
+            string str = this.lblTitle.Text;
             UserHSmartWindowControl.hImage = ho_image;
-
             if (this.InvokeRequired)
             {
                 this.BeginInvoke(new Action(() =>
@@ -135,7 +135,7 @@
                     ClearObj();
                     result = Run(out msg);
 
-                    if (ProcessRunBll.GetImage(_Layout, out _, out HObject RecordImage))
+                    if (ProcessRunBll.GetImage(_Layout, out _, out HImage RecordImage))
                     {
                         ShowHoImage(RecordImage);
                     }
@@ -198,7 +198,7 @@
                     ProcessRunBll.LogInfo($"{ProcessRunBll.Name}杩愯缁撴潫,缁撴灉涓�:{msg}"
                         , result ? LogInfoType.PASS : LogInfoType.ERROR);
 
-                    if (ProcessRunBll.GetImage(_Layout, out _, out HObject RecordImage))
+                    if (ProcessRunBll.GetImage(_Layout, out _, out HImage RecordImage))
                     {
                         ShowHoImage(RecordImage);
                     }
diff --git a/LB_SmartVision/Forms/Pages/ProcessPage/ProcessPage.cs b/LB_SmartVision/Forms/Pages/ProcessPage/ProcessPage.cs
index ce25c32..3baa903 100644
--- a/LB_SmartVision/Forms/Pages/ProcessPage/ProcessPage.cs
+++ b/LB_SmartVision/Forms/Pages/ProcessPage/ProcessPage.cs
@@ -64,7 +64,7 @@
             else
                 btn_Run.ButtonType = ReaLTaiizor.Util.HopeButtonType.Danger;
 
-            if (ProcessRunBll.GetImage(out _, out HObject RecordImage))
+            if (ProcessRunBll.GetImage(out _, out HImage RecordImage))
                 UserHSmartWindowControl.ShowHoImage(RecordImage);
         }
 
@@ -93,7 +93,7 @@
                 LogInfo?.Invoke(string.Format("娴佺▼[{0}]杩愯瀹屾垚,缁撴灉:{1}", this.ProcessRunBll.Name, msg)
                     , result ? LogInfoType.PASS : LogInfoType.ERROR);
 
-                if (ProcessRunBll.GetImage(out _, out HObject RecordImage))
+                if (ProcessRunBll.GetImage(out _, out HImage RecordImage))
                     UserHSmartWindowControl.ShowHoImage(RecordImage);
 
                 if (result)
diff --git a/LB_SmartVision/ProcessRun/ProcessContext.cs b/LB_SmartVision/ProcessRun/ProcessContext.cs
index ff803a2..79d4ada 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 HImage InputImage, out HImage RecordImage)
         {
             InputImage = null; RecordImage = null;
             try
@@ -337,9 +337,9 @@
                     else if (o_InputImage != null && o_InputImage is Bitmap)
                     {
                         //灏哅at杞崲涓篐Object
-                        using (HImage ho_RecordImage = TAlgorithm.Bitmap2HObject((Bitmap)o_InputImage))
+                        using (HImage ho_RecordImage = TAlgorithm.Bitmap2HImage((Bitmap)o_InputImage))
                         {
-                            if (ho_RecordImage != null)
+                            if (ho_RecordImage != null && ho_RecordImage.Key != IntPtr.Zero)
                             {
                                 InputImage = ho_RecordImage.Clone();
                             }
@@ -348,16 +348,16 @@
                     else if (o_InputImage != null && o_InputImage is Mat)
                     {
                         //灏哅at杞崲涓篐Object
-                        using (HImage ho_RecordImage = TAlgorithm.Mat2HObject((Mat)o_InputImage))
+                        using (HImage ho_RecordImage = TAlgorithm.Mat2HImage((Mat)o_InputImage))
                         {
-                            if (ho_RecordImage != null)
+                            if (ho_RecordImage != null && ho_RecordImage.Key != IntPtr.Zero)
                             {
                                 InputImage = ho_RecordImage.Clone();
                             }
                         }
                     }
 
-                    if (InputImage != null && InputImage.IsInitialized())
+                    if (InputImage != null && InputImage.Key != IntPtr.Zero && InputImage.IsInitialized())
                     {
                         InputImage.GetImageSize(out ho_ImageWidth, out ho_ImageHeight);
 
@@ -387,11 +387,13 @@
 
                     if (dicContext.ContainsKey(IndexProcessName))
                     {
-                        ObjectRecord objectRecord1 = ((IProcess)dicContext[IndexProcessName]).Record;
-                        if (objectRecord1 != null)
+                        using (ObjectRecord objectRecord1 = ((IProcess)dicContext[IndexProcessName]).Record)
                         {
-                            objectRecord1.Display(hWindowControl.HalconWindow);
-                            objectRecord1.Dispose();
+                            if (objectRecord1 != null)
+                            {
+                                objectRecord1.Display(hWindowControl.HalconWindow);
+                                objectRecord1.Dispose();
+                            }
                         }
                     }
                 }
@@ -405,11 +407,13 @@
 
                     if (dicContext.ContainsKey(IndexProcessName))
                     {
-                        ObjectRecord objectRecord2 = ((IProcess)dicContext[IndexProcessName]).Record;
-                        if (objectRecord2 != null)
+                        using (ObjectRecord objectRecord2 = ((IProcess)dicContext[IndexProcessName]).Record)
                         {
-                            objectRecord2.Display(hWindowControl.HalconWindow);
-                            objectRecord2.Dispose();
+                            if (objectRecord2 != null)
+                            {
+                                objectRecord2.Display(hWindowControl.HalconWindow);
+                                objectRecord2.Dispose();
+                            }
                         }
                     }
                 }
@@ -423,11 +427,13 @@
 
                     if (dicContext.ContainsKey(IndexProcessName))
                     {
-                        ObjectRecord objectRecord3 = ((IProcess)dicContext[IndexProcessName]).Record;
-                        if (objectRecord3 != null)
+                        using (ObjectRecord objectRecord3 = ((IProcess)dicContext[IndexProcessName]).Record)
                         {
-                            objectRecord3.Display(hWindowControl.HalconWindow);
-                            objectRecord3.Dispose();
+                            if (objectRecord3 != null)
+                            {
+                                objectRecord3.Display(hWindowControl.HalconWindow);
+                                objectRecord3.Dispose();
+                            }
                         }
                     }
                 }
@@ -435,13 +441,13 @@
                 if (Result)
                 {
                     Msg = "杩愯鎴愬姛";
-                    HOperatorSet.SetColor(hWindowControl.HalconWindow, "green");
+                    hWindowControl.HalconWindow.SetColor("green");
                 }
                 else
-                    HOperatorSet.SetColor(hWindowControl.HalconWindow, "red");
+                    hWindowControl.HalconWindow.SetColor("red");
 
                 TAlgorithm.DispMsg(Msg, hWindowControl.HalconWindow, Result ? "green" : "red", 0, 0);
-                HOperatorSet.DumpWindowImage(out RecordImage, hWindowControl.HalconWindow);
+                RecordImage = hWindowControl.HalconWindow.DumpWindowImage();
                 #endregion
 
                 return true;
diff --git a/LB_SmartVision/ProcessRun/ProcessRunBll.cs b/LB_SmartVision/ProcessRun/ProcessRunBll.cs
index 547af4d..9e2301f 100644
--- a/LB_SmartVision/ProcessRun/ProcessRunBll.cs
+++ b/LB_SmartVision/ProcessRun/ProcessRunBll.cs
@@ -121,12 +121,12 @@
         /// </summary>
         public double RunTime = 0;
 
-        public bool GetImage(Forms.Pages.SettingPage.Layout layout, out HImage InputImage, out HObject RecordImage)
+        public bool GetImage(Forms.Pages.SettingPage.Layout layout, out HImage InputImage, out HImage RecordImage)
         {
             return ProcessContext.GetImage(layout, out InputImage, out RecordImage);
         }
 
-        public bool GetImage(out HImage InputImage, out HObject RecordImage)
+        public bool GetImage(out HImage InputImage, out HImage RecordImage)
         {
             InputImage = null;
             RecordImage = null;
diff --git a/LB_SmartVision/VisionForm.cs b/LB_SmartVision/VisionForm.cs
index 53a775f..7b6a9bf 100644
--- a/LB_SmartVision/VisionForm.cs
+++ b/LB_SmartVision/VisionForm.cs
@@ -1438,7 +1438,7 @@
                     }
                     // 鐢熸垚鍥剧墖骞舵樉绀哄埌鎺т欢涓�
                     HImage InputImage = null;
-                    HObject RecordImage = null;
+                    HImage RecordImage = null;
 
                     foreach (var layout in GlobalVar.dicLayout.Values
                                 .Where(layout => layout.ProcessName == ProcessName)
diff --git a/LB_VisionControl/UserHSmartWindowControl.cs b/LB_VisionControl/UserHSmartWindowControl.cs
index a1c3acb..6aae2eb 100644
--- a/LB_VisionControl/UserHSmartWindowControl.cs
+++ b/LB_VisionControl/UserHSmartWindowControl.cs
@@ -32,11 +32,11 @@
         /// </summary>
         public bool bAutoSize = true;
 
-        private HObject _hImage = null;
+        private HImage _hImage = null;
         /// <summary>
         /// 鏄剧ず鍥剧墖(寮傛)
         /// </summary>
-        public HObject hImage
+        public HImage hImage
         {
             get
             {
@@ -273,10 +273,10 @@
         /// <param name="ho_image"></param>
         /// <param name="hWindow"></param>
         /// <param name="autoSize"></param>
-        public async void ShowHoImageAsync(HObject ho_image, HWindow hWindow, bool autoSize = true)
+        public async void ShowHoImageAsync(HImage ho_image, HWindow hWindow, bool autoSize = true)
         {
             if (ho_image == null || !ho_image.IsInitialized())
-                HOperatorSet.ClearWindow(hWindow);
+                hWindow.ClearWindow();
             else
                 await ShowImageAsync(hWindow, ho_image, autoSize);
         }
@@ -286,10 +286,10 @@
         /// </summary>
         /// <param name="ho_image"></param>
         /// <param name="autoSize"></param>
-        public void ShowHoImage(HObject ho_image, bool autoSize = true)
+        public void ShowHoImage(HImage ho_image, bool autoSize = true)
         {
             _hImage = ho_image;
-            HOperatorSet.ClearWindow(hWindowControl.HalconWindow);
+            hWindowControl.HalconWindow.ClearWindow();
 
             if (ho_image == null)
                 return;
@@ -343,7 +343,7 @@
             return;
         }
 
-        private async Task<bool> ShowImageAsync(HWindow hWindow, HObject ho_image, bool autoSize = true)
+        private async Task<bool> ShowImageAsync(HWindow hWindow, HImage ho_image, bool autoSize = true)
         {
             return await Task.Run(() =>
             {
@@ -351,7 +351,7 @@
                 {
                     try
                     {
-                        HOperatorSet.ClearWindow(hWindow);
+                        hWindow.ClearWindow();
                     }
                     catch { return false; }
                     return true;
@@ -359,11 +359,11 @@
 
                 try
                 {
-                    HOperatorSet.ClearWindow(hWindow);
+                    hWindow.ClearWindow();
 
                     if (autoSize)
                     {
-                        HOperatorSet.GetImageSize(ho_image, out HTuple imgWidth, out HTuple imgHeight);
+                        ho_image.GetImageSize(out HTuple imgWidth, out HTuple imgHeight);
                         if (imgWidth.Length > 0)
                         {
                             hWindow.GetWindowExtents(out int winRow, out int winCol, out int winWidth, out int winHeight);
@@ -395,7 +395,7 @@
                         }
                     }
 
-                    HOperatorSet.DispObj(ho_image, hWindow);
+                    hWindow.DispObj(ho_image);
                 }
                 catch { return false; }
                 return true;
@@ -421,7 +421,7 @@
             try
             {
                 if (ho_object != null && ho_object.IsInitialized())
-                    HOperatorSet.DispObj(ho_object, this.hWindowControl.HalconWindow);
+                    this.hWindowControl.HalconWindow.DispObj(ho_object);
             }
             catch { }
         }
@@ -433,7 +433,7 @@
                 if (ho_object != null && ho_object.IsInitialized())
                 {
                     SetColor(color);
-                    HOperatorSet.DispObj(ho_object, this.hWindowControl.HalconWindow);
+                    this.hWindowControl.HalconWindow.DispObj(ho_object);
                 }
             }
             catch { }
@@ -447,7 +447,7 @@
                 {
                     string color = result ? "green" : "red";
                     SetColor(color);
-                    HOperatorSet.DispObj(ho_object, this.hWindowControl.HalconWindow);
+                    this.hWindowControl.HalconWindow.DispObj(ho_object);
                 }
             }
             catch { }
@@ -488,7 +488,7 @@
 
                 if (this.color != color)
                 {
-                    HOperatorSet.SetColor(this.hWindowControl.HalconWindow, color);
+                    this.hWindowControl.HalconWindow.SetColor( color);
                     this.color = color;
                 }
             }
diff --git a/LB_VisionProcesses/Alogrithms/BaseAlgorithm/TAlgorithm.cs b/LB_VisionProcesses/Alogrithms/BaseAlgorithm/TAlgorithm.cs
index 919f3bd..a024c9d 100644
--- a/LB_VisionProcesses/Alogrithms/BaseAlgorithm/TAlgorithm.cs
+++ b/LB_VisionProcesses/Alogrithms/BaseAlgorithm/TAlgorithm.cs
@@ -521,13 +521,13 @@
                 return value;
         }
 
-        public static HImage Bitmap2HObject(Bitmap bmp)
+        public static HImage Bitmap2HImage(Bitmap bmp)
         {
             BitmapData srcBmpData;
             HImage image = null;
             try
             {
-                if (bmp.Tag != null && bmp == null || bmp.Width == 0 || bmp.Height == 0)
+                if (bmp.Tag == null || bmp == null || bmp.Width == 0 || bmp.Height == 0)
                 {
                     image = null;
                     return image;
@@ -601,7 +601,7 @@
             }
         }
 
-        public static unsafe void HObject2Bitmap(HImage hImage, out Bitmap bmp)
+        public static unsafe void HImage2Bitmap(HImage hImage, out Bitmap bmp)
         {
             try
             {
@@ -685,7 +685,7 @@
             }
         }
 
-        public static HImage Mat2HObject(Mat mat)
+        public static HImage Mat2HImage(Mat mat)
         {
             HImage image = null;
             try
diff --git a/LB_VisionProcesses/Alogrithms/BaseAlgorithm/TAlgorithmEdit.cs b/LB_VisionProcesses/Alogrithms/BaseAlgorithm/TAlgorithmEdit.cs
index 70d13aa..6ded39b 100644
--- a/LB_VisionProcesses/Alogrithms/BaseAlgorithm/TAlgorithmEdit.cs
+++ b/LB_VisionProcesses/Alogrithms/BaseAlgorithm/TAlgorithmEdit.cs
@@ -66,20 +66,20 @@
                     return;
                 }
 
-                if (InputImage is HObject)
+                if (InputImage is HImage)
                 {
-                    inputImageHSmartWindowControl.ShowHoImage((HObject)value);
+                    inputImageHSmartWindowControl.ShowHoImage((HImage)value);
                 }
                 else if (InputImage is Bitmap)
                 {
-                    using (HImage image = TAlgorithm.Bitmap2HObject((Bitmap)value))
+                    using (HImage image = TAlgorithm.Bitmap2HImage((Bitmap)value))
                     {
                         inputImageHSmartWindowControl.ShowHoImage(image);
                     }
                 }
                 else if (InputImage is Mat)
                 {
-                    using (HImage image = TAlgorithm.Mat2HObject((Mat)value))
+                    using (HImage image = TAlgorithm.Mat2HImage((Mat)value))
                     {
                         inputImageHSmartWindowControl.ShowHoImage(image);
                     }
diff --git a/LB_VisionProcesses/Alogrithms/BaseAlgorithm/TestTool/TestToolEdit.cs b/LB_VisionProcesses/Alogrithms/BaseAlgorithm/TestTool/TestToolEdit.cs
index 5038929..d8bccd0 100644
--- a/LB_VisionProcesses/Alogrithms/BaseAlgorithm/TestTool/TestToolEdit.cs
+++ b/LB_VisionProcesses/Alogrithms/BaseAlgorithm/TestTool/TestToolEdit.cs
@@ -89,7 +89,7 @@
                 stxtInput.Text = Subject.Params.Inputs["杈撳叆"].ToString();
 
                 if (Subject.InputImage != null && Subject.InputImage is HObject)
-                    inputImageHSmartWindowControl.ShowHoImage((HObject)Subject.InputImage);
+                    inputImageHSmartWindowControl.ShowHoImage((HImage)Subject.InputImage);
 
                 Type type = Subject.Params.ROI?.GetType();
                 if (Subject.Params.ROI != null)
@@ -179,21 +179,21 @@
                 {
                     if (Subject.OutputImage is Mat)
                     {
-                        using (HImage image = TAlgorithm.Mat2HObject((Mat)Subject.OutputImage))
+                        using (HImage image = TAlgorithm.Mat2HImage((Mat)Subject.OutputImage))
                         {
                             recordImageHSmartWindowControl.ShowHoImage(image);
                         }
                     }
                     else if (Subject.OutputImage is Bitmap)
                     {
-                        using (HImage image = TAlgorithm.Bitmap2HObject((Bitmap)Subject.OutputImage))
+                        using (HImage image = TAlgorithm.Bitmap2HImage((Bitmap)Subject.OutputImage))
                         {
                             recordImageHSmartWindowControl.ShowHoImage(image);
                         }
                     }
-                    else if (Subject.OutputImage is HObject)
+                    else if (Subject.OutputImage is HImage)
                     {
-                        recordImageHSmartWindowControl.ShowHoImage((HObject)Subject.OutputImage);
+                        recordImageHSmartWindowControl.ShowHoImage((HImage)Subject.OutputImage);
                     }
                 }
                 //鍏堝垽鏂瓙绫诲啀鍒ゆ柇鐖剁被
diff --git a/LB_VisionProcesses/Alogrithms/Halcon/2D/HBlobTool/HBlobToolEdit.cs b/LB_VisionProcesses/Alogrithms/Halcon/2D/HBlobTool/HBlobToolEdit.cs
index 066ab08..10403a0 100644
--- a/LB_VisionProcesses/Alogrithms/Halcon/2D/HBlobTool/HBlobToolEdit.cs
+++ b/LB_VisionProcesses/Alogrithms/Halcon/2D/HBlobTool/HBlobToolEdit.cs
@@ -216,8 +216,8 @@
                 }
                 catch { }
 
-                if (Subject.InputImage != null && Subject.InputImage is HObject)
-                    inputImageHSmartWindowControl.ShowHoImage((HObject)Subject.InputImage);
+                if (Subject.InputImage != null && Subject.InputImage is HImage)
+                    inputImageHSmartWindowControl.ShowHoImage((HImage)Subject.InputImage);
 
                 Type type = Subject.Params.ROI?.GetType();
                 if (Subject.Params.ROI != null)
@@ -308,12 +308,14 @@
                 UpdataOutputs();
                 imgTabControl.SelectedTab = tabPageRecordImage;
 
-                if (Subject.InputImage != null && Subject.InputImage is HObject)
+                if (Subject.InputImage != null && Subject.InputImage is HImage)
                 {
-                    HOperatorSet.GetImageSize((HObject)Subject.InputImage, out HTuple ho_ImageWidth, out HTuple ho_ImageHeight);
-                    recordImageHSmartWindowControl.ShowHoImage((HObject)Subject.InputImage);
+                    using (HImage hImage = (HImage)Subject.InputImage)
+                    {
+                        hImage.GetImageSize(out HTuple ho_ImageWidth, out HTuple ho_ImageHeight);
+                        recordImageHSmartWindowControl.ShowHoImage(hImage);
+                    }
                 }
-
                 //鍏堝垽鏂瓙绫诲啀鍒ゆ柇鐖剁被
                 if (Subject.Record != null && Subject.Record is MsgRecord msgRecord)
                 {
diff --git a/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindCode2dTool/HFindCode2dToolEdit.cs b/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindCode2dTool/HFindCode2dToolEdit.cs
index e0bdaec..0e1a3dc 100644
--- a/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindCode2dTool/HFindCode2dToolEdit.cs
+++ b/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindCode2dTool/HFindCode2dToolEdit.cs
@@ -106,8 +106,13 @@
                 dtxtMinCount.Text = Subject.Params.Inputs["MinCount"].ToString();
                 dtxtMaxCount.Text = Subject.Params.Inputs["MaxCount"].ToString();
 
-                if (Subject.InputImage != null && Subject.InputImage is HObject)
-                    inputImageHSmartWindowControl.ShowHoImage((HObject)Subject.InputImage);
+                if (Subject.InputImage != null && Subject.InputImage is HImage)
+                {
+                    using (HImage hImage = (HImage)Subject.InputImage)
+                    {
+                        inputImageHSmartWindowControl.ShowHoImage(hImage);
+                    }
+                }
 
                 Type type = Subject.Params.ROI?.GetType();
                 if (Subject.Params.ROI != null)
@@ -193,10 +198,13 @@
                 UpdataOutputs();
                 imgTabControl.SelectedTab = tabPageRecordImage;
 
-                if (Subject.InputImage != null && Subject.InputImage is HObject)
+                if (Subject.InputImage != null && Subject.InputImage is HImage)
                 {
-                    HOperatorSet.GetImageSize((HObject)Subject.InputImage, out HTuple ho_ImageWidth, out HTuple ho_ImageHeight);
-                    recordImageHSmartWindowControl.ShowHoImage((HObject)Subject.InputImage);
+                    using (HImage hImage= (HImage)Subject.InputImage)
+                    {
+                        hImage.GetImageSize(out HTuple ho_ImageWidth, out HTuple ho_ImageHeight);
+                        recordImageHSmartWindowControl.ShowHoImage(hImage);
+                    }
                 }
 
                 //鍏堝垽鏂瓙绫诲啀鍒ゆ柇鐖剁被
diff --git a/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindLineTool/HFindLineToolEdit.cs b/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindLineTool/HFindLineToolEdit.cs
index 026965d..944e6ba 100644
--- a/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindLineTool/HFindLineToolEdit.cs
+++ b/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindLineTool/HFindLineToolEdit.cs
@@ -144,7 +144,13 @@
                 cmbSelect.Text = Subject.Params.Inputs["杈圭紭浣嶇疆"].ToString();
 
                 if (Subject.InputImage != null && Subject.InputImage is HObject)
-                    inputImageHSmartWindowControl.ShowHoImage((HObject)Subject.InputImage);
+                {
+                    using (HImage hImage = (HImage)Subject.InputImage)
+                    {
+                        //hImage.GetImageSize(out HTuple ho_ImageWidth, out HTuple ho_ImageHeight);
+                        inputImageHSmartWindowControl.ShowHoImage(hImage);
+                    }
+                }
 
                 Type type = Subject.Params.ROI?.GetType();
                 if (Subject.Params.ROI != null)
@@ -254,10 +260,13 @@
                 UpdataOutputs();
                 imgTabControl.SelectedTab = tabPageRecordImage;
 
-                if (Subject.InputImage != null && Subject.InputImage is HObject)
+                if (Subject.InputImage != null && Subject.InputImage is HImage)
                 {
-                    HOperatorSet.GetImageSize((HObject)Subject.InputImage, out HTuple ho_ImageWidth, out HTuple ho_ImageHeight);
-                    recordImageHSmartWindowControl.ShowHoImage((HObject)Subject.InputImage);
+                    using (HImage hImage = (HImage)Subject.InputImage)
+                    {
+                        hImage.GetImageSize(out HTuple ho_ImageWidth, out HTuple ho_ImageHeight);
+                        recordImageHSmartWindowControl.ShowHoImage(hImage);
+                    }
                 }
 
                 //鍏堝垽鏂瓙绫诲啀鍒ゆ柇鐖剁被
@@ -393,8 +402,14 @@
 
                     inputImageHSmartWindowControl.ClearObj();
 
-                    if (Subject.InputImage != null && Subject.InputImage is HObject)
-                        inputImageHSmartWindowControl.ShowHoImage((HObject)Subject.InputImage);
+                    if (Subject.InputImage != null && Subject.InputImage is HImage)
+                    {
+                        using (HImage hImage = (HImage)Subject.InputImage)
+                        {
+                            hImage.GetImageSize(out HTuple ho_ImageWidth, out HTuple ho_ImageHeight);
+                            inputImageHSmartWindowControl.ShowHoImage(hImage);
+                        }
+                    }
 
                     int hv_Elements = Convert.ToInt16(itxtCaliperCount.Text);
                     double hv_DetectHeight = Convert.ToDouble(dtxtCaliperHeight.Text);
diff --git a/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindModelTool/HFindModelToolEdit.cs b/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindModelTool/HFindModelToolEdit.cs
index ffed42b..2729c6f 100644
--- a/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindModelTool/HFindModelToolEdit.cs
+++ b/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindModelTool/HFindModelToolEdit.cs
@@ -448,9 +448,15 @@
                     }
                 }
 
-                if (Subject.InputImage != null && Subject.InputImage is HObject)
-                    inputImageHSmartWindowControl.ShowHoImage((HObject)Subject.InputImage);
+                if (Subject.InputImage != null && Subject.InputImage is HImage)
+                {
+                    using (HImage hImage = (HImage)Subject.InputImage)
+                    {
+                        hImage.GetImageSize(out HTuple ho_ImageWidth, out HTuple ho_ImageHeight);
+                        inputImageHSmartWindowControl.ShowHoImage(hImage);
+                    }
 
+                }
                 Type type = Subject.Params.ROI?.GetType();
                 if (Subject.Params.ROI != null)
                 {
@@ -563,10 +569,13 @@
                 UpdataOutputs();
                 imgTabControl.SelectedTab = tabPageRecordImage;
 
-                if (Subject.InputImage != null && Subject.InputImage is HObject)
+                if (Subject.InputImage != null && Subject.InputImage is HImage)
                 {
-                    HOperatorSet.GetImageSize((HObject)Subject.InputImage, out HTuple ho_ImageWidth, out HTuple ho_ImageHeight);
-                    recordImageHSmartWindowControl.ShowHoImage((HObject)Subject.InputImage);
+                    using (HImage hImage = (HImage)Subject.InputImage)
+                    {
+                        hImage.GetImageSize(out HTuple ho_ImageWidth, out HTuple ho_ImageHeight);
+                        recordImageHSmartWindowControl.ShowHoImage(hImage);
+                    }
                 }
 
                 //鍏堝垽鏂瓙绫诲啀鍒ゆ柇鐖剁被
@@ -1291,15 +1300,18 @@
 
         private void btnCreateModel_Click(object sender, EventArgs e)
         {
-            if (InputImage != null && InputImage is HObject)
+            if (InputImage != null && InputImage is HImage)
             {
                 imgTabControl.SelectedTab = tabPageModelImage;
 
-                HOperatorSet.GetImageSize((HObject)InputImage, out HTuple hv_imageWidth, out HTuple hv_imageHeight);
-                createModelImageHSmartWindowControl.ShowHoImage((HObject)InputImage);
-                createModelImageHSmartWindowControl.bAollowDraw = true;
-                createModelImageHSmartWindowControl.oRoi = new HRectangle2(hv_imageWidth.TupleReal() / 2, hv_imageHeight.TupleReal() / 2
-                    , 0, hv_imageWidth.TupleReal() / 4, hv_imageHeight.TupleReal() / 4);
+                using (HImage hImage = (HImage)Subject.InputImage)
+                {
+                    hImage.GetImageSize(out HTuple hv_imageWidth, out HTuple hv_imageHeight);
+                    createModelImageHSmartWindowControl.ShowHoImage(hImage);
+                    createModelImageHSmartWindowControl.bAollowDraw = true;
+                    createModelImageHSmartWindowControl.oRoi = new HRectangle2(hv_imageWidth.TupleReal() / 2, hv_imageHeight.TupleReal() / 2
+                        , 0, hv_imageWidth.TupleReal() / 4, hv_imageHeight.TupleReal() / 4);
+                }
             }
         }
 
diff --git a/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindMultiModelTool/HFindMultiModelToolEdit.cs b/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindMultiModelTool/HFindMultiModelToolEdit.cs
index bf95ace..cfcfe6c 100644
--- a/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindMultiModelTool/HFindMultiModelToolEdit.cs
+++ b/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindMultiModelTool/HFindMultiModelToolEdit.cs
@@ -137,9 +137,14 @@
                 dtxtMinCount.Text = Subject.Params.Inputs["MinCount"].ToString();
                 dtxtMaxCount.Text = Subject.Params.Inputs["MaxCount"].ToString();
 
-                if (Subject.InputImage != null && Subject.InputImage is HObject)
-                    inputImageHSmartWindowControl.ShowHoImage((HObject)Subject.InputImage);
-
+                if (Subject.InputImage != null && Subject.InputImage is HImage)
+                {
+                    using (HImage hImage = (HImage)Subject.InputImage)
+                    {
+                        hImage.GetImageSize(out HTuple ho_ImageWidth, out HTuple ho_ImageHeight);
+                        inputImageHSmartWindowControl.ShowHoImage(hImage);
+                    }
+                }
                 Type type = Subject.Params.ROI?.GetType();
                 if (Subject.Params.ROI != null)
                 {
@@ -249,10 +254,13 @@
                 UpdataOutputs();
                 imgTabControl.SelectedTab = tabPageRecordImage;
 
-                if (Subject.InputImage != null && Subject.InputImage is HObject)
+                if (Subject.InputImage != null && Subject.InputImage is HImage)
                 {
-                    HOperatorSet.GetImageSize((HObject)Subject.InputImage, out HTuple ho_ImageWidth, out HTuple ho_ImageHeight);
-                    recordImageHSmartWindowControl.ShowHoImage((HObject)Subject.InputImage);
+                    using (HImage hImage = (HImage)Subject.InputImage)
+                    {
+                        hImage.GetImageSize(out HTuple ho_ImageWidth, out HTuple ho_ImageHeight);
+                        recordImageHSmartWindowControl.ShowHoImage(hImage);
+                    }
                 }
 
                 //鍏堝垽鏂瓙绫诲啀鍒ゆ柇鐖剁被
diff --git a/LB_VisionProcesses/Alogrithms/OpenCvSharp/BlobTool/BlobToolEdit.cs b/LB_VisionProcesses/Alogrithms/OpenCvSharp/BlobTool/BlobToolEdit.cs
index cfe7641..53ff69d 100644
--- a/LB_VisionProcesses/Alogrithms/OpenCvSharp/BlobTool/BlobToolEdit.cs
+++ b/LB_VisionProcesses/Alogrithms/OpenCvSharp/BlobTool/BlobToolEdit.cs
@@ -120,7 +120,7 @@
 
                 if (Subject.InputImage != null && Subject.InputImage is Mat)
                 {
-                    using (HImage image = TAlgorithm.Mat2HObject((Mat)Subject.InputImage))
+                    using (HImage image = TAlgorithm.Mat2HImage((Mat)Subject.InputImage))
                     {
                         inputImageHSmartWindowControl.ShowHoImage(image);
                     }
@@ -216,7 +216,7 @@
 
                 if (Subject.InputImage != null && Subject.InputImage is Mat)
                 {
-                    using (HImage image = TAlgorithm.Mat2HObject((Mat)Subject.InputImage))
+                    using (HImage image = TAlgorithm.Mat2HImage((Mat)Subject.InputImage))
                     {
                         HOperatorSet.GetImageSize(image, out HTuple ho_ImageWidth, out HTuple ho_ImageHeight);
                         recordImageHSmartWindowControl.ShowHoImage(image);
@@ -306,7 +306,7 @@
                     HTuple hv_imageHeight = 0;
                     if (InputImage != null && InputImage is Mat)
                     {
-                        using (HImage image = TAlgorithm.Mat2HObject((Mat)InputImage))
+                        using (HImage image = TAlgorithm.Mat2HImage((Mat)InputImage))
                         {
                             image.GetImageSize(out hv_imageWidth, out hv_imageHeight);
                             switch (type)
diff --git a/LB_VisionProcesses/Alogrithms/OpenCvSharp/FindLineTool/FindLineToolEdit.cs b/LB_VisionProcesses/Alogrithms/OpenCvSharp/FindLineTool/FindLineToolEdit.cs
index d84fcbd..f914bb9 100644
--- a/LB_VisionProcesses/Alogrithms/OpenCvSharp/FindLineTool/FindLineToolEdit.cs
+++ b/LB_VisionProcesses/Alogrithms/OpenCvSharp/FindLineTool/FindLineToolEdit.cs
@@ -144,7 +144,7 @@
 
                 if (Subject.InputImage != null && Subject.InputImage is Mat)
                 {
-                    using (HImage image = TAlgorithm.Mat2HObject((Mat)Subject.InputImage))
+                    using (HImage image = TAlgorithm.Mat2HImage((Mat)Subject.InputImage))
                     {
                         inputImageHSmartWindowControl.ShowHoImage(image);
                         Type type = Subject.Params.ROI?.GetType();
@@ -259,7 +259,7 @@
 
                 if (Subject.InputImage != null && Subject.InputImage is Mat)
                 {
-                    using (HImage image = TAlgorithm.Mat2HObject((Mat)Subject.InputImage))
+                    using (HImage image = TAlgorithm.Mat2HImage((Mat)Subject.InputImage))
                     {
                         image.GetImageSize(out HTuple ho_ImageWidth, out HTuple ho_ImageHeight);
                         recordImageHSmartWindowControl.ShowHoImage(image);
@@ -346,7 +346,7 @@
                     HTuple hv_imageHeight = 0;
                     if (InputImage != null && InputImage is Mat)
                     {
-                        using (HImage image=TAlgorithm.Mat2HObject((Mat)InputImage))
+                        using (HImage image=TAlgorithm.Mat2HImage((Mat)InputImage))
                         {
                             image.GetImageSize(out hv_imageWidth, out hv_imageHeight);
                             switch (type)
@@ -400,7 +400,7 @@
 
                     if (InputImage != null && InputImage is Mat)
                     {
-                        using (HImage image = TAlgorithm.Mat2HObject((Mat)InputImage))
+                        using (HImage image = TAlgorithm.Mat2HImage((Mat)InputImage))
                         {
                             inputImageHSmartWindowControl.ShowHoImage(image);
                             int hv_Elements = Convert.ToInt16(itxtCaliperCount.Text);
diff --git a/LB_VisionProcesses/Alogrithms/OpenCvSharp/FindModelTool/FindModelToolEdit.cs b/LB_VisionProcesses/Alogrithms/OpenCvSharp/FindModelTool/FindModelToolEdit.cs
index 5e2e2df..441c1b1 100644
--- a/LB_VisionProcesses/Alogrithms/OpenCvSharp/FindModelTool/FindModelToolEdit.cs
+++ b/LB_VisionProcesses/Alogrithms/OpenCvSharp/FindModelTool/FindModelToolEdit.cs
@@ -241,7 +241,7 @@
 
                 if (Subject.InputImage != null && Subject.InputImage is Mat)
                 {
-                    using (HImage image = TAlgorithm.Mat2HObject((Mat)Subject.InputImage))
+                    using (HImage image = TAlgorithm.Mat2HImage((Mat)Subject.InputImage))
                     {
                         inputImageHSmartWindowControl.ShowHoImage(image);
                         Type type = Subject.Params.ROI?.GetType();
@@ -359,7 +359,7 @@
 
                 if (Subject.InputImage != null && Subject.InputImage is Mat)
                 {
-                    using (HImage image = TAlgorithm.Mat2HObject((Mat)Subject.InputImage))
+                    using (HImage image = TAlgorithm.Mat2HImage((Mat)Subject.InputImage))
                     {
                         image.GetImageSize(out HTuple ho_ImageWidth, out HTuple ho_ImageHeight);
                         recordImageHSmartWindowControl.ShowHoImage(image);
@@ -502,7 +502,7 @@
                     HTuple hv_imageHeight = 0;
                     if (InputImage != null && InputImage is Mat)
                     {
-                        using (HImage image = TAlgorithm.Mat2HObject((Mat)InputImage))
+                        using (HImage image = TAlgorithm.Mat2HImage((Mat)InputImage))
                         {
                             HOperatorSet.GetImageSize(image, out hv_imageWidth, out hv_imageHeight);
                             switch (type)
@@ -1102,10 +1102,10 @@
             if (InputImage != null && InputImage is Mat)
             {
                 imgTabControl.SelectedTab = tabPageModelImage;
-                using (HImage hoDomainImage = TAlgorithm.Mat2HObject((Mat)InputImage))
+                using (HImage hoDomainImage = TAlgorithm.Mat2HImage((Mat)InputImage))
                 {
                     HOperatorSet.GetImageSize(hoDomainImage, out HTuple hv_imageWidth, out HTuple hv_imageHeight);
-                    createModelImageHSmartWindowControl.ShowHoImage((HObject)hoDomainImage);
+                    createModelImageHSmartWindowControl.ShowHoImage(hoDomainImage);
                     createModelImageHSmartWindowControl.bAollowDraw = true;
                     createModelImageHSmartWindowControl.oRoi = new HRectangle2(hv_imageWidth.TupleReal() / 2, hv_imageHeight.TupleReal() / 2
                         , 0, hv_imageWidth.TupleReal() / 4, hv_imageHeight.TupleReal() / 4);
@@ -1140,7 +1140,7 @@
                         using (HRegion hRectangle = new HRegion())
                         {
                             hRectangle.GenRectangle2(ROI.Row, ROI.Column, ROI.Phi, ROI.SemiLength1, ROI.SemiLength2);
-                            using (HImage hoDomainImage = TAlgorithm.Mat2HObject((Mat)InputImage))
+                            using (HImage hoDomainImage = TAlgorithm.Mat2HImage((Mat)InputImage))
                             {
                                 HTuple hv_Channels = new HTuple();
                                 //鍒ゆ柇鏄惁涓虹伆搴﹀浘
@@ -1205,7 +1205,7 @@
                                         //寤烘ā鎴愬姛瀵艰埅鍒板瓙椤�
                                         parasTabControl.SelectedTab = tabPageRunParas;
                                         //modelImageHSmartWindowControl.ShowHoImage(((HFindModelTool)Subject).ModelID.hoImage);
-                                        using (HImage modelImage = TAlgorithm.Mat2HObject(((FindModelTool)Subject).ModelID.hoImage))
+                                        using (HImage modelImage = TAlgorithm.Mat2HImage(((FindModelTool)Subject).ModelID.hoImage))
                                         {
                                             modelImageHSmartWindowControl.ShowHoImage(modelImage);
                                             modelImageHSmartWindowControl.DispObj(ho_ModelContours, false);
@@ -1247,7 +1247,7 @@
                         //HOperatorSet.AffineTransContourXld(ho_ModelContours, out ho_ModelContours, hv_HomMat2D);
 
                         modelImageHSmartWindowControl.ClearObj();
-                        using (HImage hoImage = TAlgorithm.Mat2HObject(ModelID.hoImage))
+                        using (HImage hoImage = TAlgorithm.Mat2HImage(ModelID.hoImage))
                         {
                             //modelImageHSmartWindowControl.ShowHoImage(ModelID.hoImage);
                             modelImageHSmartWindowControl.ShowHoImage(hoImage);

--
Gitblit v1.9.3