From ea6b4332f32f2bdbdcbf4d9cd7f02fea187d120d Mon Sep 17 00:00:00 2001
From: C3031 <shitiangui@lanpucloud.cn>
Date: 星期三, 31 十二月 2025 08:51:46 +0800
Subject: [PATCH] 新增用户控制管理界面
---
LB_VisionProcesses/Cameras/CameraConfig.cs | 28 +++++++++++++++++++++++-----
1 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/LB_VisionProcesses/Cameras/CameraConfig.cs b/LB_VisionProcesses/Cameras/CameraConfig.cs
index 66303bd..8210a2e 100644
--- a/LB_VisionProcesses/Cameras/CameraConfig.cs
+++ b/LB_VisionProcesses/Cameras/CameraConfig.cs
@@ -1,6 +1,7 @@
锘縰sing Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using OpenCvSharp;
+using OpenCvSharp.Extensions;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Text;
@@ -190,7 +191,7 @@
Mat src = Cv2.ImRead(SN);
if (src != null && !src.Empty())
- OutputImage = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(src);
+ OutputImage = src.ToBitmap();
}
}
}
@@ -256,12 +257,17 @@
{
times--;
if (TriggerSource == TriggerSource.Software)
+ {
Camera.GetImageWithSoftTrigger(out bitmap, timeout);
+ }
else
+ {
Camera.GetImage(out bitmap, timeout);
-
+ }
if (bitmap != null)
+ {
break;
+ }
else if (isRegrab)
{
Debug.WriteLine($"鍙栧浘澶辫触,閲嶆柊鍙栧浘,鍓╀綑娆℃暟:{times}");
@@ -269,8 +275,9 @@
} while (times > 0 && isRegrab);
if (isUpParams)
+ {
Camera.SetCamConfig(oriConfig);
-
+ }
OutputImage = bitmap;
}
@@ -293,14 +300,23 @@
{
Result = true;
Msg = "";
- OutputImage = null;
-
+ if (OutputImage != null)
+ {
+ if (OutputImage is Bitmap)
+ {
+ ((Bitmap)OutputImage).Dispose();
+ }
+ OutputImage = null;
+ }
if (Record != null)
+ {
Record.Dispose();
+ }
}
public override void Dispose()
{
+
return;
}
@@ -314,7 +330,9 @@
if (OutputImage != null)
{
if (OutputImage is Bitmap)
+ {
obj.OutputImage = ((Bitmap)OutputImage).Clone();
+ }
}
return obj;
--
Gitblit v1.9.3