From b48ac75b89e94e3f70da5a2233e18734aa271682 Mon Sep 17 00:00:00 2001
From: C3204 <zhengyabo@lanpucloud.cn>
Date: 星期四, 16 四月 2026 13:45:50 +0800
Subject: [PATCH] 丐版相机外触发同一流程触发一次。
---
LB_VisionProcesses/Cameras/BaseCamera.cs | 52 ++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 42 insertions(+), 10 deletions(-)
diff --git a/LB_VisionProcesses/Cameras/BaseCamera.cs b/LB_VisionProcesses/Cameras/BaseCamera.cs
index 4928e18..e6b8e8f 100644
--- a/LB_VisionProcesses/Cameras/BaseCamera.cs
+++ b/LB_VisionProcesses/Cameras/BaseCamera.cs
@@ -1,8 +1,10 @@
锘縰sing HalconDotNet;
-using MvCameraControl;
+using LB_SmartVisionCommon;
using LB_VisionProcesses;
using LB_VisionProcesses.Cameras;
+using MvCameraControl;
using System;
+using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
@@ -36,22 +38,52 @@
protected Bitmap CallBackImg { get; set; }
public Bitmap Bitmap;
- private Dictionary<string, List<Bitmap>> _collectedImages;
- public Dictionary<string, List<Bitmap>> CollectedImages
- {
- get => _collectedImages;
- set
- {
- _collectedImages = value;
- }
- }
+ //private ConcurrentDictionary<string, ConcurrentQueue<Bitmap>> _collectedImages;
+ public ConcurrentDictionary<string, ConcurrentQueue<Bitmap>> CollectedImages = new ConcurrentDictionary<string, ConcurrentQueue<Bitmap>>();
+ //{
+ // get => _collectedImages;
+ // set
+ // {
+ // _collectedImages = value;
+ // }
+ //}
+
+ /// <summary>
+ /// 闃熷垪涓婇檺锛岄槻姝㈠唴瀛樼垎鐐�
+ /// </summary>
+ public int MAX_QUEUE_CAPACITY = 30;
+
+ /// <summary>
+ /// 鏄惁鍚屼竴娴佺▼
+ /// </summary>
+ public string isProcess = string.Empty;
+
+ public static bool _isProcess = true;
+
+
#endregion
#region operate
+
+ /// <summary>
+ /// 鐩告満閿�姣佹椂锛氭竻绌烘墍鏈夌紦瀛橈紝閲婃斁鍏ㄩ儴鍐呭瓨
+ /// </summary>
+ public virtual void ClearAllImages()
+ {
+ if (CollectedImages.TryRemove(SN, out var queue))
+ {
+ while (queue.TryDequeue(out Bitmap bmp))
+ {
+ bmp.Dispose();
+ }
+ }
+ AsyncLogHelper.Info($"LBCamera[{SN}]: 宸叉竻绌烘墍鏈夊浘鍍忕紦瀛�");
+ }
public virtual void Dispose()
{
try
{
+ ClearAllImages();
CloseDevice();
}
catch { }
--
Gitblit v1.9.3