From ebcc1d53f14112363bbf539bcaf0202aadcdc9d7 Mon Sep 17 00:00:00 2001
From: C3032 <1057644574@qq.com>
Date: 星期一, 13 四月 2026 12:58:58 +0800
Subject: [PATCH] 2D取图计数功能完成

---
 LB_VisionProcesses/Cameras/CameraConfig.cs |   41 +++++++++++++++++++++++++++++++++++++----
 1 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/LB_VisionProcesses/Cameras/CameraConfig.cs b/LB_VisionProcesses/Cameras/CameraConfig.cs
index 8210a2e..3b619c9 100644
--- a/LB_VisionProcesses/Cameras/CameraConfig.cs
+++ b/LB_VisionProcesses/Cameras/CameraConfig.cs
@@ -1,7 +1,9 @@
-锘縰sing Newtonsoft.Json;
+锘縰sing HalconDotNet;
+using Newtonsoft.Json;
 using Newtonsoft.Json.Serialization;
 using OpenCvSharp;
 using OpenCvSharp.Extensions;
+using System;
 using System.Collections.Concurrent;
 using System.Diagnostics;
 using System.Text;
@@ -40,6 +42,11 @@
 
             Params.Inputs.Add("瓒呮椂鏃堕棿", 1000);
             Params.Inputs.Add("鏄惁澶辫触閲嶆柊鍙栧浘", false);
+
+            // 2D杞儙璁℃暟閰嶇疆锛堥粯璁や负1锛岃〃绀�3D妯″紡锛�2D鐩告満璁剧疆涓簄锛�
+            Params.Inputs.Add("ImagesPerTyre", 1);
+            Params.Inputs.Add("褰撳墠杞儙ID", 1);
+            Params.Inputs.Add("褰撳墠鍥惧儚搴忓彿", 0);
         }
 
         /// <summary>
@@ -302,21 +309,47 @@
             Msg = "";
             if (OutputImage != null)
             {
-                if (OutputImage is Bitmap)
-                {
+                if (OutputImage is HObject)
+                    ((HObject)OutputImage).Dispose();
+                else if (OutputImage is Mat)
+                    ((Mat)OutputImage).Dispose();
+                else if (OutputImage is Bitmap)
                     ((Bitmap)OutputImage).Dispose();
-                }
+
                 OutputImage = null;
             }
             if (Record != null)
             {
                 Record.Dispose();
+                Record = null;
             }
         }
 
         public override void Dispose()
         {
+            if (InputImage != null)
+            {
+                if (InputImage is HObject)
+                    ((HObject)InputImage).Dispose();
+                else if (InputImage is Mat)
+                    ((Mat)InputImage).Dispose();
+                else if (InputImage is Bitmap)
+                    ((Bitmap)InputImage).Dispose();
 
+                InputImage = null;
+            }
+
+            if (OutputImage != null)
+            {
+                if (OutputImage is HObject)
+                    ((HObject)OutputImage).Dispose();
+                else if (OutputImage is Mat)
+                    ((Mat)OutputImage).Dispose();
+                else if (OutputImage is Bitmap)
+                    ((Bitmap)OutputImage).Dispose();
+
+                OutputImage = null;
+            }
             return;
         }
 

--
Gitblit v1.9.3