| LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.Designer.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| LB_SmartVision/ProcessRun/ProcessContext.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| LB_VisionProcesses/Alogrithms/BaseAlgorithm/TAlgorithm.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| LB_VisionProcesses/Cameras/CameraConfig.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.Designer.cs
@@ -13,6 +13,7 @@ /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> protected override void Dispose(bool disposing) { this.isClosed = true; if (disposing && (components != null)) { components.Dispose(); LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.cs
@@ -43,6 +43,11 @@ if (ProcessRunBll != null) this.label1.Text = $"总数:{ProcessRunBll.total}"; this.isClosed = false ; var TaskPhotoContinue = Task.Factory.StartNew(() => { ThreadCircleRun(); }); } public void SetTitle(string title) @@ -149,37 +154,36 @@ if (isCircleRuning) { threadCircleRun = new Thread(ThreadCircleRun); threadCircleRun.IsBackground = true; threadCircleRun.Start(); this.mAutoResetEvent.Set(); } else { isCircleRuning = false; threadCircleRun.Abort(); } if (!isCircleRuning) { ProcessRunBll.LogInfo($"{ProcessRunBll.Name}关闭连续运行", LogInfoType.PASS); return; } ProcessRunBll.LogInfo($"{ProcessRunBll.Name}开启连续运行", LogInfoType.WARN); } catch { } } Thread threadCircleRun = null; private AutoResetEvent mAutoResetEvent = new AutoResetEvent(false); bool isClosed = false; void ThreadCircleRun() { if (!isCircleRuning) while (!isClosed) { ProcessRunBll.LogInfo($"{ProcessRunBll.Name}关闭连续运行", LogInfoType.PASS); return; } ProcessRunBll.LogInfo($"{ProcessRunBll.Name}开启连续运行", LogInfoType.WARN); while (isCircleRuning) { //this.BeginInvoke(new Action(() => //{ try { if (isCircleRuning == false) { this.mAutoResetEvent.WaitOne(); } ProcessRunBll.LogInfo($"{ProcessRunBll.Name}开始运行", LogInfoType.WARN); ClearObj(); bool result = ProcessRunBll.Run(); @@ -192,9 +196,7 @@ ShowHoImage(RecordImage); } catch { } //})); Thread.Sleep(100); Thread.Sleep(33); } } LB_SmartVision/ProcessRun/ProcessContext.cs
@@ -9,6 +9,7 @@ using LB_VisionProcesses.Processes.ScriptTool; using OpenCvSharp; using System.Collections.Concurrent; using System.Windows.Media.Media3D; namespace LB_SmartVision.ProcessRun { @@ -489,7 +490,37 @@ if (dicContext.TryGetValue(ProcessName, out IProcess obj) && obj is IProcess process) { process.InputImage = null; //process.InputImage = null; if (process.InputImage != null) { if (process.InputImage is HObject) ((HObject)process.InputImage).Dispose(); else if (process.InputImage is Mat) ((Mat)process.InputImage).Dispose(); else if (process.InputImage is Bitmap) ((Bitmap)process.InputImage).Dispose(); process.InputImage = null; } if (process.OutputImage != null) { if (process.OutputImage is HObject) ((HObject)process.OutputImage).Dispose(); else if (process.OutputImage is Mat) ((Mat)process.OutputImage).Dispose(); else if (process.OutputImage is Bitmap) ((Bitmap)process.OutputImage).Dispose(); process.OutputImage = null; } if (process.Record != null) { process.Record.Dispose(); process.Record = null; } UpdateInputs(process); // 不同节点跳过的方式不同 LB_VisionProcesses/Alogrithms/BaseAlgorithm/TAlgorithm.cs
@@ -304,7 +304,16 @@ Result = true; bCompleted = false; Msg = ""; OutputImage = 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; } if (Record != null) Record.Dispose(); LB_VisionProcesses/Cameras/CameraConfig.cs
@@ -1,7 +1,9 @@ using Newtonsoft.Json; using 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; @@ -302,21 +304,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; }