C3204
2026-01-28 693a6135b4762c20c01b5df52ea2da9ae73f237b
配方界面整合以及主界面布局。
已修改11个文件
397 ■■■■ 文件已修改
LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.Designer.cs 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.cs 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/ProcessRun/ProcessRunBll.cs 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/VisionForm.Designer.cs 140 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/VisionForm.cs 122 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_VisionFlowNode/FlowPanel.cs 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_VisionProcesses/Alogrithms/Halcon/2D/HBlobTool/HBlobTool.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_VisionProcesses/Alogrithms/Halcon/2D/HFindCode2dTool/HFindCode2dTool.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_VisionProcesses/Alogrithms/Halcon/2D/HFindLineTool/HFindLineTool.cs 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_VisionProcesses/Alogrithms/Halcon/2D/HFindModelTool/HFindModelTool.cs 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_VisionProcesses/Alogrithms/Halcon/2D/HFindMultiModelTool/HFindMultiModelTool.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.Designer.cs
@@ -71,6 +71,7 @@
            btnRun.Size = new Size(93, 24);
            btnRun.Text = "单次运行";
            btnRun.ToolTipText = "单次运行";
            btnRun.Visible = false;
            btnRun.Click += btnRun_Click;
            // 
            // btnCircleRun
@@ -82,6 +83,7 @@
            btnCircleRun.Size = new Size(93, 24);
            btnCircleRun.Text = "连续运行";
            btnCircleRun.ToolTipText = "连续";
            btnCircleRun.Visible = false;
            btnCircleRun.Click += btnCircleRun_Click;
            // 
            // panel1
@@ -156,7 +158,7 @@
            BackColor = Color.FromArgb(32, 41, 50);
            Controls.Add(uiPanel1);
            Controls.Add(toolStrip1);
            Margin = new Padding(4, 4, 4, 4);
            Margin = new Padding(4);
            Name = "ProcessControl";
            Size = new Size(450, 287);
            Load += ProcessControl_Load;
LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.cs
@@ -10,6 +10,16 @@
    {
        UserHSmartWindowControl UserHSmartWindowControl = new UserHSmartWindowControl();
        public event ProcessRunBllRun OnProcessRunBllRun;
        private void onProcessRunBllRun()
        {
            if (OnProcessRunBllRun != null)
            {
                OnProcessRunBllRun();
            }
        }
        public string Title = string.Empty;
        public event Control_MouseDown event_MouseDown;
@@ -130,8 +140,8 @@
            if (isCircleRuning || ProcessRunBll.bRuning)
                ProcessRunBll.LogInfo($"{ProcessRunBll.Name}正在运行", LogInfoType.ERROR);
            ProcessRunBll.Run();
            //ProcessRunBll.Run();
            onProcessRunBllRun();
            msg = ProcessRunBll.Msg;
            return ProcessRunBll.Result;
        }
LB_SmartVision/ProcessRun/ProcessRunBll.cs
@@ -17,6 +17,8 @@
namespace LB_SmartVision.ProcessRun
{
    public delegate void ProcessRunBllRun();
    public class ProcessRunBll
    {
@@ -648,7 +650,7 @@
                    {
                        dicOutputsMapping.TryAdd(name, new List<string>());
                        dicOutputsMapping[name].Add(name + ".Outputs.Image");
                        //dicOutputsMapping[name].Add(name + ".Outputs.Record");
                        dicOutputsMapping[name].Add(name + ".Outputs.Record");
                        dicOutputsMapping[name].Add(name + ".Outputs.Result");
                        foreach (var item in process.Params.Outputs)
LB_SmartVision/VisionForm.Designer.cs
@@ -35,9 +35,11 @@
            materialTabControl = new MaterialSkin.Controls.MaterialTabControl();
            tlp_VisionMainOperator = new Sunny.UI.UITableLayoutPanel();
            ckb_AllowRun = new Sunny.UI.UICheckBox();
            btn_Login = new ReaLTaiizor.Controls.Button();
            btn_GlobalVar = new ReaLTaiizor.Controls.Button();
            com_ProductName = new ReaLTaiizor.Controls.AloneComboBox();
            btn_SingleRun = new Sunny.UI.UIButton();
            btn_Login = new Sunny.UI.UIButton();
            btn_RunContinuously = new Sunny.UI.UIButton();
            btn_GlobalVar = new Sunny.UI.UIButton();
            materialTabSelector = new MaterialSkin.Controls.MaterialTabSelector();
            grb_Info = new Sunny.UI.UIGroupBox();
            rich_Info = new Sunny.UI.UIRichTextBox();
@@ -89,7 +91,7 @@
            // 
            sc_VisionForm.Panel2.Controls.Add(grb_Info);
            sc_VisionForm.Size = new Size(1416, 781);
            sc_VisionForm.SplitterDistance = 593;
            sc_VisionForm.SplitterDistance = 572;
            sc_VisionForm.SplitterWidth = 5;
            sc_VisionForm.TabIndex = 1;
            // 
@@ -108,7 +110,7 @@
            tlp_MainView.RowStyles.Add(new RowStyle(SizeType.Absolute, 60F));
            tlp_MainView.RowStyles.Add(new RowStyle(SizeType.Absolute, 39F));
            tlp_MainView.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
            tlp_MainView.Size = new Size(1416, 593);
            tlp_MainView.Size = new Size(1416, 572);
            tlp_MainView.TabIndex = 1;
            tlp_MainView.TagString = null;
            // 
@@ -122,7 +124,7 @@
            materialTabControl.MouseState = MaterialSkin.MouseState.HOVER;
            materialTabControl.Name = "materialTabControl";
            materialTabControl.SelectedIndex = 0;
            materialTabControl.Size = new Size(1412, 490);
            materialTabControl.Size = new Size(1412, 469);
            materialTabControl.TabIndex = 0;
            // 
            // tlp_VisionMainOperator
@@ -139,9 +141,11 @@
            tlp_VisionMainOperator.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 11.1111107F));
            tlp_VisionMainOperator.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 11.1111107F));
            tlp_VisionMainOperator.Controls.Add(ckb_AllowRun, 0, 0);
            tlp_VisionMainOperator.Controls.Add(btn_Login, 1, 0);
            tlp_VisionMainOperator.Controls.Add(btn_GlobalVar, 7, 0);
            tlp_VisionMainOperator.Controls.Add(com_ProductName, 8, 0);
            tlp_VisionMainOperator.Controls.Add(btn_SingleRun, 2, 0);
            tlp_VisionMainOperator.Controls.Add(btn_Login, 1, 0);
            tlp_VisionMainOperator.Controls.Add(btn_RunContinuously, 3, 0);
            tlp_VisionMainOperator.Controls.Add(btn_GlobalVar, 7, 0);
            tlp_VisionMainOperator.Dock = DockStyle.Fill;
            tlp_VisionMainOperator.Location = new Point(4, 64);
            tlp_VisionMainOperator.Margin = new Padding(4);
@@ -165,50 +169,6 @@
            ckb_AllowRun.TabIndex = 2;
            ckb_AllowRun.Text = "运行模式";
            // 
            // btn_Login
            //
            btn_Login.BackColor = Color.Transparent;
            btn_Login.BorderColor = Color.FromArgb(32, 34, 37);
            btn_Login.Dock = DockStyle.Fill;
            btn_Login.EnteredBorderColor = Color.FromArgb(165, 37, 37);
            btn_Login.EnteredColor = Color.FromArgb(32, 34, 37);
            btn_Login.Font = new Font("宋体", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
            btn_Login.Image = null;
            btn_Login.ImageAlign = ContentAlignment.MiddleLeft;
            btn_Login.InactiveColor = Color.FromArgb(32, 34, 37);
            btn_Login.Location = new Point(160, 4);
            btn_Login.Margin = new Padding(4);
            btn_Login.Name = "btn_Login";
            btn_Login.PressedBorderColor = Color.FromArgb(165, 37, 37);
            btn_Login.PressedColor = Color.FromArgb(165, 37, 37);
            btn_Login.Size = new Size(148, 23);
            btn_Login.TabIndex = 3;
            btn_Login.Text = "用户登录";
            btn_Login.TextAlignment = StringAlignment.Center;
            btn_Login.Click += btn_Login_Click;
            //
            // btn_GlobalVar
            //
            btn_GlobalVar.BackColor = Color.Gray;
            btn_GlobalVar.BorderColor = Color.FromArgb(32, 34, 37);
            btn_GlobalVar.Dock = DockStyle.Fill;
            btn_GlobalVar.EnteredBorderColor = Color.FromArgb(165, 37, 37);
            btn_GlobalVar.EnteredColor = Color.FromArgb(32, 34, 37);
            btn_GlobalVar.Font = new Font("宋体", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 0);
            btn_GlobalVar.Image = null;
            btn_GlobalVar.ImageAlign = ContentAlignment.MiddleLeft;
            btn_GlobalVar.InactiveColor = Color.FromArgb(32, 34, 37);
            btn_GlobalVar.Location = new Point(1096, 4);
            btn_GlobalVar.Margin = new Padding(4);
            btn_GlobalVar.Name = "btn_GlobalVar";
            btn_GlobalVar.PressedBorderColor = Color.FromArgb(165, 37, 37);
            btn_GlobalVar.PressedColor = Color.FromArgb(165, 37, 37);
            btn_GlobalVar.Size = new Size(148, 23);
            btn_GlobalVar.TabIndex = 4;
            btn_GlobalVar.Text = "全局变量";
            btn_GlobalVar.TextAlignment = StringAlignment.Center;
            btn_GlobalVar.Click += btn_GlobalVar_Click;
            //
            // com_ProductName
            // 
            com_ProductName.Dock = DockStyle.Fill;
@@ -224,6 +184,74 @@
            com_ProductName.Size = new Size(152, 26);
            com_ProductName.TabIndex = 5;
            com_ProductName.SelectedValueChanged += com_ProductName_SelectedValueChanged;
            //
            // btn_SingleRun
            //
            btn_SingleRun.BackColor = Color.FromArgb(39, 51, 63);
            btn_SingleRun.Dock = DockStyle.Fill;
            btn_SingleRun.FillColor = Color.FromArgb(39, 51, 63);
            btn_SingleRun.FillColor2 = Color.FromArgb(39, 51, 63);
            btn_SingleRun.FillSelectedColor = Color.FromArgb(128, 255, 128);
            btn_SingleRun.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
            btn_SingleRun.Location = new Point(315, 3);
            btn_SingleRun.MinimumSize = new Size(1, 1);
            btn_SingleRun.Name = "btn_SingleRun";
            btn_SingleRun.Size = new Size(150, 25);
            btn_SingleRun.TabIndex = 6;
            btn_SingleRun.Text = "单次运行";
            btn_SingleRun.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
            btn_SingleRun.Click += btn_Run_Click;
            //
            // btn_Login
            //
            btn_Login.BackColor = Color.FromArgb(39, 51, 63);
            btn_Login.Dock = DockStyle.Fill;
            btn_Login.FillColor = Color.FromArgb(39, 51, 63);
            btn_Login.FillColor2 = Color.FromArgb(39, 51, 63);
            btn_Login.FillSelectedColor = Color.FromArgb(128, 255, 128);
            btn_Login.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
            btn_Login.Location = new Point(159, 3);
            btn_Login.MinimumSize = new Size(1, 1);
            btn_Login.Name = "btn_Login";
            btn_Login.Size = new Size(150, 25);
            btn_Login.TabIndex = 6;
            btn_Login.Text = "用户登录";
            btn_Login.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
            btn_Login.Click += btn_Login_Click;
            //
            // btn_RunContinuously
            //
            btn_RunContinuously.BackColor = Color.FromArgb(39, 51, 63);
            btn_RunContinuously.Dock = DockStyle.Fill;
            btn_RunContinuously.FillColor = Color.FromArgb(39, 51, 63);
            btn_RunContinuously.FillColor2 = Color.FromArgb(39, 51, 63);
            btn_RunContinuously.FillSelectedColor = Color.FromArgb(128, 255, 128);
            btn_RunContinuously.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
            btn_RunContinuously.Location = new Point(471, 3);
            btn_RunContinuously.MinimumSize = new Size(1, 1);
            btn_RunContinuously.Name = "btn_RunContinuously";
            btn_RunContinuously.Size = new Size(150, 25);
            btn_RunContinuously.TabIndex = 6;
            btn_RunContinuously.Text = "连续运行";
            btn_RunContinuously.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
            btn_RunContinuously.Click += btn_RunContinuously_Click;
            //
            // btn_GlobalVar
            //
            btn_GlobalVar.BackColor = Color.FromArgb(39, 51, 63);
            btn_GlobalVar.Dock = DockStyle.Fill;
            btn_GlobalVar.FillColor = Color.FromArgb(39, 51, 63);
            btn_GlobalVar.FillColor2 = Color.FromArgb(39, 51, 63);
            btn_GlobalVar.FillSelectedColor = Color.FromArgb(128, 255, 128);
            btn_GlobalVar.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
            btn_GlobalVar.Location = new Point(1095, 3);
            btn_GlobalVar.MinimumSize = new Size(1, 1);
            btn_GlobalVar.Name = "btn_GlobalVar";
            btn_GlobalVar.Size = new Size(150, 25);
            btn_GlobalVar.TabIndex = 6;
            btn_GlobalVar.Text = "全局变量";
            btn_GlobalVar.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
            btn_GlobalVar.Click += btn_GlobalVar_Click;
            // 
            // materialTabSelector
            // 
@@ -249,7 +277,7 @@
            grb_Info.MinimumSize = new Size(1, 1);
            grb_Info.Name = "grb_Info";
            grb_Info.Padding = new Padding(0, 40, 0, 0);
            grb_Info.Size = new Size(1416, 183);
            grb_Info.Size = new Size(1416, 204);
            grb_Info.TabIndex = 1;
            grb_Info.Text = "日志显示区:";
            grb_Info.TextAlignment = ContentAlignment.MiddleLeft;
@@ -265,7 +293,7 @@
            rich_Info.Name = "rich_Info";
            rich_Info.Padding = new Padding(2);
            rich_Info.ShowText = false;
            rich_Info.Size = new Size(1416, 143);
            rich_Info.Size = new Size(1416, 164);
            rich_Info.TabIndex = 0;
            rich_Info.TextAlignment = ContentAlignment.MiddleLeft;
            // 
@@ -321,13 +349,15 @@
        private SplitContainer sc_VisionForm;
        private Sunny.UI.UITableLayoutPanel tlp_VisionMainOperator;
        private Sunny.UI.UICheckBox ckb_AllowRun;
        private ReaLTaiizor.Controls.Button btn_Login;
        private ReaLTaiizor.Controls.Button btn_GlobalVar;
        private Sunny.UI.UIGroupBox grb_Info;
        private Sunny.UI.UIRichTextBox rich_Info;
        private MaterialSkin.Controls.MaterialTabControl materialTabControl;
        private ReaLTaiizor.Controls.AloneComboBox com_ProductName;
        private MaterialSkin.Controls.MaterialTabSelector materialTabSelector;
        private Sunny.UI.UITableLayoutPanel tlp_MainView;
        private Sunny.UI.UIButton btn_SingleRun;
        private Sunny.UI.UIButton btn_Login;
        private Sunny.UI.UIButton btn_RunContinuously;
        private Sunny.UI.UIButton btn_GlobalVar;
    }
}
LB_SmartVision/VisionForm.cs
@@ -1716,6 +1716,128 @@
                communicator.Disconnect();
            }
            FormClosing -= VisionForm_FormClosing;
            //try
            //{
            //    Process[] processes = System.Diagnostics.Process.GetProcesses(); //获得所有进程
            //    foreach (Process p in processes)
            //    {
            //        if (p.ProcessName == "LB_SmartVision" && p.StartTime < DateTime.Now.AddMilliseconds(-300))
            //        {
            //            p.Kill();
            //        }
            //    }
            //}
            //catch { }
            KillAllTargetProcesses();
        }
        /// <summary>
        /// 杀进程逻辑
        /// </summary>
        private void KillAllTargetProcesses()
        {
            try
            {
                // 1. 获取当前进程ID,避免杀死自己
                int currentProcessId = Process.GetCurrentProcess().Id;
                // 2. 模糊匹配进程名(忽略大小写),覆盖vshost/后缀等情况
                var targetProcesses = Process.GetProcesses()
                    .Where(p =>
                        p.ProcessName.IndexOf("LB_SmartVision", StringComparison.OrdinalIgnoreCase) >= 0
                        && p.Id == currentProcessId);
                foreach (var p in targetProcesses)
                {
                    try
                    {
                        if (!p.HasExited)
                        {
                            // 先尝试优雅关闭WinForm程序(比直接Kill更友好)
                            p.CloseMainWindow();
                            // 等待500ms,看是否正常退出
                            if (!p.WaitForExit(500))
                            {
                                p.Kill(); // 强制杀死
                                p.WaitForExit(1000); // 等待进程完全终止
                            }
                        }
                        p.Dispose(); // 释放进程资源,避免句柄泄漏
                    }
                    catch (Exception ex)
                    {
                        // 记录异常但不中断,比如权限不足的情况
                        System.IO.File.AppendAllText("kill_process_log.txt", $"[{DateTime.Now}] 杀死进程失败: {ex.Message}\r\n");
                    }
                }
                // 额外延迟,确保文件句柄完全释放
                Thread.Sleep(1000);
            }
            catch (Exception)
            {
                // 静默失败,不影响程序退出
            }
        }
        private void btn_Run_Click(object sender, EventArgs e)
        {
            var matchedItems = GlobalVar.dicProcessSetting
                                        .Where(item =>
                                        {
                                            var value = item.Value;
                                            var triggerComm = value["触发通讯"];
                                            var triggerChar = value["触发字符"];
                                            return triggerComm != null;
                                            //return triggerComm != null && triggerComm.Equals(name) &&
                                            //       (string.IsNullOrEmpty(triggerChar?.ToString()) ||
                                            //        msg.StartsWith(triggerChar.ToString()));
                                        })
                                        .ToList(); // 避免重复字典访问和装箱操作
            if (matchedItems.Count <= 0)
            {
                return;
            }
            TriggerRunMessageReceived(matchedItems[0].Value["触发通讯"], matchedItems[0].Value["触发字符"]);
        }
        private void btn_RunContinuously_Click(object sender, EventArgs e)
        {
            if (btn_RunContinuously.Text.Equals("连续运行"))
            {
                btn_RunContinuously.Text = "暂停运行";
                Task.Factory.StartNew(() =>
                {
                    var matchedItems = GlobalVar.dicProcessSetting
                                                .Where(item =>
                                                {
                                                    var value = item.Value;
                                                    var triggerComm = value["触发通讯"];
                                                    var triggerChar = value["触发字符"];
                                                    return triggerComm != null;
                                                    //return triggerComm != null && triggerComm.Equals(name) &&
                                                    //       (string.IsNullOrEmpty(triggerChar?.ToString()) ||
                                                    //        msg.StartsWith(triggerChar.ToString()));
                                                })
                                                .ToList(); // 避免重复字典访问和装箱操作
                    while (btn_RunContinuously.Text.Equals("暂停运行"))
                    {
                        TriggerRunMessageReceived(matchedItems[0].Value["触发通讯"], matchedItems[0].Value["触发字符"]);
                        Thread.Sleep(500);
                    }
                    //this.Invoke(() =>
                    //{
                    //});
                });
            }
            else if (btn_RunContinuously.Text.Equals("暂停运行"))
            {
                btn_RunContinuously.Text = "连续运行";
                Thread.Sleep(100);
            }
        }
    }
}
LB_VisionFlowNode/FlowPanel.cs
@@ -1,4 +1,5 @@
using System.Collections.Concurrent;
using LB_SmartVisionCommon;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Xml.Linq;
@@ -305,6 +306,7 @@
            bool result = Context.ExecuteNode(currentNode);
#if DEBUG
            Debug.WriteLine(DateTime.Now.ToString("[yyyy:MM:dd:HH:mm:ss:fff] ") + $"执行节点[{currentNode.Text}],结果为{result}");
            AsyncLogHelper.Debug(DateTime.Now.ToString("[yyyy:MM:dd:HH:mm:ss:fff] ") + $"执行节点[{currentNode.Text}],结果为{result}");
#endif
            context.BranchResults.TryAdd(context.CurrentBranchName, currentNode.Result);
            currentNode.Result = result;
LB_VisionProcesses/Alogrithms/Halcon/2D/HBlobTool/HBlobTool.cs
@@ -85,10 +85,13 @@
                    {
                        using (HImage hImage = new HImage())
                        {
                            Rectangle rect = new Rectangle(0, 0, ((Bitmap)InputImage).Width, ((Bitmap)InputImage).Height);
                            BitmapData srcBmpData = ((Bitmap)InputImage).LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format32bppRgb);
                            hImage.GenImageInterleaved(srcBmpData.Scan0, "rgbx", ((Bitmap)InputImage).Width, ((Bitmap)InputImage).Height, 0, "byte", ((Bitmap)InputImage).Width, ((Bitmap)InputImage).Height, 0, 0, -1, 0);
                            ((Bitmap)InputImage).UnlockBits(srcBmpData);
                            Bitmap bitmap = (Bitmap)InputImage;
                            Rectangle rect = new Rectangle(0, 0, ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height);
                            BitmapData srcBmpData = ((Bitmap)bitmap).LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format32bppRgb);
                            hImage.GenImageInterleaved(srcBmpData.Scan0, "rgbx", ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height, 0, "byte", ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height, 0, 0, -1, 0);
                            ((Bitmap)bitmap).UnlockBits(srcBmpData);
                            bitmap.Dispose();
                            bitmap = null;
                            InputImage = null;
                            InputImage = hImage.Clone();
                        }
LB_VisionProcesses/Alogrithms/Halcon/2D/HFindCode2dTool/HFindCode2dTool.cs
@@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -64,9 +65,30 @@
                        Result = false;
                        return;
                    }
                    if (InputImage is Bitmap)
                    {
                        try
                        {
                            using (HImage hImage = new HImage())
                            {
                                Bitmap bitmap = (Bitmap)InputImage;
                                Rectangle rect = new Rectangle(0, 0, ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height);
                                BitmapData srcBmpData = ((Bitmap)bitmap).LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format32bppRgb);
                                hImage.GenImageInterleaved(srcBmpData.Scan0, "rgbx", ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height, 0, "byte", ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height, 0, 0, -1, 0);
                                ((Bitmap)bitmap).UnlockBits(srcBmpData);
                                bitmap.Dispose();
                                bitmap = null;
                                InputImage = null;
                                InputImage = hImage.Clone();
                            }
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                    if (!(InputImage is HObject))
                    {
                        Msg = "输入图片格式不为Mat";
                        Msg = "输入图片格式不为HObject";
                        Result = false;
                        return;
                    }
LB_VisionProcesses/Alogrithms/Halcon/2D/HFindLineTool/HFindLineTool.cs
@@ -3,6 +3,7 @@
using LB_VisionProcesses.Alogrithms.Halcon;
using System;
using System.Collections.Generic;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -61,6 +62,33 @@
                    Result = false;
                    return;
                }
                if (InputImage is Bitmap)
                {
                    try
                    {
                        using (HImage hImage = new HImage())
                        {
                            Bitmap bitmap = (Bitmap)InputImage;
                            Rectangle rect = new Rectangle(0, 0, ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height);
                            BitmapData srcBmpData = ((Bitmap)bitmap).LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format32bppRgb);
                            hImage.GenImageInterleaved(srcBmpData.Scan0, "rgbx", ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height, 0, "byte", ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height, 0, 0, -1, 0);
                            ((Bitmap)bitmap).UnlockBits(srcBmpData);
                            bitmap.Dispose();
                            bitmap = null;
                            InputImage = null;
                            InputImage = hImage.Clone();
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }
                if (!(InputImage is HObject))
                {
                    Msg = "输入图片格式不为HObject";
                    Result = false;
                    return;
                }
                #region 裁剪区域
                if (!(Params.ROI is HSegment))
LB_VisionProcesses/Alogrithms/Halcon/2D/HFindModelTool/HFindModelTool.cs
@@ -5,6 +5,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -93,6 +94,27 @@
                        Result = false;
                        return;
                    }
                    if (InputImage is Bitmap)
                    {
                        try
                        {
                            using (HImage hImage = new HImage())
                            {
                                Bitmap bitmap = (Bitmap)InputImage;
                                Rectangle rect = new Rectangle(0, 0, ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height);
                                BitmapData srcBmpData = ((Bitmap)bitmap).LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format32bppRgb);
                                hImage.GenImageInterleaved(srcBmpData.Scan0, "rgbx", ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height, 0, "byte", ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height, 0, 0, -1, 0);
                                ((Bitmap)bitmap).UnlockBits(srcBmpData);
                                bitmap.Dispose();
                                bitmap = null;
                                InputImage = null;
                                InputImage = hImage.Clone();
                            }
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                    if (!(InputImage is HObject))
                    {
                        Msg = "输入图片格式不为HObject";
LB_VisionProcesses/Alogrithms/Halcon/2D/HFindMultiModelTool/HFindMultiModelTool.cs
@@ -5,6 +5,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -88,9 +89,30 @@
                        Result = false;
                        return;
                    }
                    if (InputImage is Bitmap)
                    {
                        try
                        {
                            using (HImage hImage = new HImage())
                            {
                                Bitmap bitmap = (Bitmap)InputImage;
                                Rectangle rect = new Rectangle(0, 0, ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height);
                                BitmapData srcBmpData = ((Bitmap)bitmap).LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format32bppRgb);
                                hImage.GenImageInterleaved(srcBmpData.Scan0, "rgbx", ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height, 0, "byte", ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height, 0, 0, -1, 0);
                                ((Bitmap)bitmap).UnlockBits(srcBmpData);
                                bitmap.Dispose();
                                bitmap = null;
                                InputImage = null;
                                InputImage = hImage.Clone();
                            }
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                    if (!(InputImage is HObject))
                    {
                        Msg = "输入图片格式不为Mat";
                        Msg = "输入图片格式不为HObject";
                        Result = false;
                        return;
                    }