| | |
| | | using LB_VisionProcesses.Processes.ScriptTool; |
| | | using OpenCvSharp; |
| | | using System.Collections.Concurrent; |
| | | using System.Windows.Media.Media3D; |
| | | |
| | | namespace LB_SmartVision.ProcessRun |
| | | { |
| | |
| | | return res; |
| | | } |
| | | |
| | | public bool GetImage(Layout layout, out HImage InputImage, out HObject RecordImage) |
| | | public bool GetImage(Layout layout, out HObject InputImage, out HObject RecordImage) |
| | | { |
| | | InputImage = null; RecordImage = null; |
| | | try |
| | |
| | | IndexValueName = arrOutputs[2]; |
| | | |
| | | object o_InputImage = ((IProcess)dicContext[IndexProcessName]).OutputImage; |
| | | if (o_InputImage is HImage ho_image && ho_image.IsInitialized()) |
| | | if (o_InputImage is HObject ho_image && ho_image.IsInitialized()) |
| | | InputImage = ho_image; |
| | | else if (o_InputImage is Bitmap) |
| | | { |
| | | //将Mat转换为HObject |
| | | using (HImage ho_RecordImage = TAlgorithm.Bitmap2HObject((Bitmap)o_InputImage)) |
| | | { |
| | | InputImage = ho_RecordImage.Clone(); |
| | | } |
| | | TAlgorithm.Bitmap2HObject((Bitmap)o_InputImage, out HObject ho_RecordImage); |
| | | InputImage = ho_RecordImage; |
| | | } |
| | | else if (o_InputImage is Mat) |
| | | { |
| | | //将Mat转换为HObject |
| | | using (HImage ho_RecordImage = TAlgorithm.Mat2HObject((Mat)o_InputImage)) |
| | | { |
| | | InputImage = ho_RecordImage.Clone(); |
| | | } |
| | | TAlgorithm.Mat2HObject((Mat)o_InputImage, out HObject ho_RecordImage); |
| | | InputImage = ho_RecordImage; |
| | | } |
| | | |
| | | if (InputImage != null && InputImage.IsInitialized()) |
| | |
| | | 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); |
| | | |
| | | // 不同节点跳过的方式不同 |
| | |
| | | [Node("Halcon2D斑点工具", "Halcon2D工具", "Basic", "Halcon2D斑点工具")] |
| | | public void Halcon2D斑点工具(FlowNode node) { RunNodeAsync(node); } |
| | | |
| | | [Node("通讯模块", "通讯工具", "Basic", "通讯模块")] |
| | | public void 通讯模块(FlowNode node) { RunNodeAsync(node); } |
| | | |
| | | [Node("Halcon2D图像增强", "Halcon2D工具", "Basic", "Halcon2D图像增强")] |
| | | public void Halcon2D图像增强(FlowNode node) { RunNodeAsync(node); } |
| | | |
| | | [Node("Halcon2D图像滤波", "Halcon2D工具", "Basic", "Halcon2D图像滤波")] |
| | | public void Halcon2D图像滤波(FlowNode node) { RunNodeAsync(node); } |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | | |