From a0c982ba8abdbd7569a6cae07812127a757fd410 Mon Sep 17 00:00:00 2001
From: C3032 <C3032@BC3032>
Date: 星期三, 07 一月 2026 16:02:34 +0800
Subject: [PATCH] 更新相机实例化和UI线程处理逻辑
---
LB_VisionProcesses/Cameras/2DCameraForm.cs | 41 +++++++++++++++++++++++++++--------------
1 files changed, 27 insertions(+), 14 deletions(-)
diff --git a/LB_VisionProcesses/Cameras/2DCameraForm.cs b/LB_VisionProcesses/Cameras/2DCameraForm.cs
index 6dc7029..9558b6e 100644
--- a/LB_VisionProcesses/Cameras/2DCameraForm.cs
+++ b/LB_VisionProcesses/Cameras/2DCameraForm.cs
@@ -1,6 +1,8 @@
锘縰sing HalconDotNet;
+using LB_SmartVisionCameraDevice.PHM6000;
using LB_VisionControl;
using LB_VisionProcesses.Cameras.HRCameras;
+using LB_VisionProcesses.Cameras.LBCameras;
using MVSDK_Net;
using Newtonsoft.Json.Linq;
using OpenCvSharp;
@@ -164,7 +166,7 @@
camera = new HRCamera();
break;
case CameraBrand.LBCamera:
- //camera = new LBCamera();
+ camera = new LBCamera();
break;
default:
Debug.WriteLine("鏈煡鍝佺墝");
@@ -240,7 +242,7 @@
switch (brand)
{
case CameraBrand.LBCamera:
- //camera = new LBCamera();
+ camera = new LBCamera();
break;
case CameraBrand.HRCamera:
camera = new HRCamera();
@@ -313,7 +315,19 @@
PropertyGrid pg = new PropertyGrid();
pg.Dock = DockStyle.Fill;
- pg.SelectedObject = new CameraAdvancedSettings(camera);
+
+ if (camera is LBCamera phmCamera)
+ {
+ pg.SelectedObject = phmCamera.GetSensorConfig();
+ pg.PropertyValueChanged += (s, ev) =>
+ {
+ phmCamera.UpdateSensorConfig((PHM6000SensorConfig)pg.SelectedObject);
+ };
+ }
+ else
+ {
+ pg.SelectedObject = new CameraAdvancedSettings(camera);
+ }
editForm.Controls.Add(pg);
editForm.ShowDialog();
@@ -376,21 +390,20 @@
if (e.Bitmap == null)
return;
- lock (e.Bitmap)
- {
- if (this.InvokeRequired) // 妫�鏌ユ槸鍚﹂渶瑕佸湪UI绾跨▼涓婅皟鐢�
+ lock (e.Bitmap)
{
- this.Invoke(new Action(() =>
+ if (this.InvokeRequired) // 妫�鏌ユ槸鍚﹂渶瑕佸湪UI绾跨▼涓婅皟鐢�
+ {
+ this.Invoke(new Action(() =>
+ {
+ onlinePictureBox.Image = e.Bitmap;
+ })); // 閫掑綊璋冪敤鑷韩锛屼絾杩欐鍦║I绾跨▼涓�
+ }
+ else
{
onlinePictureBox.Image = e.Bitmap;
- })); // 閫掑綊璋冪敤鑷韩锛屼絾杩欐鍦║I绾跨▼涓�
+ }
}
- else
- {
- onlinePictureBox.Image = e.Bitmap;
- }
- }
-
total.iImageCount++;
try
{
--
Gitblit v1.9.3