| | |
| | | { |
| | | uiButton1 = new HopeButton(); |
| | | uiButton2 = new LostButton(); |
| | | uiFlowLayoutPanel1 = new FlowLayoutPanel(); |
| | | uiMCLayoutPanel1 = new FlowLayoutPanel(); |
| | | tableLayoutPanel1 = new TableLayoutPanel(); |
| | | tableLayoutPanel2 = new TableLayoutPanel(); |
| | | tableLayoutPanel1.SuspendLayout(); |
| | |
| | | uiButton1.Text = "å¢å "; |
| | | uiButton1.TextColor = Color.White; |
| | | uiButton1.WarningColor = Color.FromArgb(230, 162, 60); |
| | | uiButton1.Click += uiButton1_Click; |
| | | // |
| | | // uiButton2 |
| | | // |
| | |
| | | uiButton2.TabIndex = 12; |
| | | uiButton2.Text = "æ¸
é¤"; |
| | | // |
| | | // uiFlowLayoutPanel1 |
| | | // uiMCLayoutPanel1 |
| | | // |
| | | uiFlowLayoutPanel1.BackColor = Color.FromArgb(32, 41, 50); |
| | | uiFlowLayoutPanel1.Dock = DockStyle.Fill; |
| | | uiFlowLayoutPanel1.Font = new Font("å®ä½", 12F); |
| | | uiFlowLayoutPanel1.ForeColor = SystemColors.Control; |
| | | uiFlowLayoutPanel1.Location = new Point(4, 5); |
| | | uiFlowLayoutPanel1.Margin = new Padding(4, 5, 4, 5); |
| | | uiFlowLayoutPanel1.MinimumSize = new Size(1, 1); |
| | | uiFlowLayoutPanel1.Name = "uiFlowLayoutPanel1"; |
| | | uiFlowLayoutPanel1.Padding = new Padding(2); |
| | | uiFlowLayoutPanel1.Size = new Size(599, 293); |
| | | uiFlowLayoutPanel1.TabIndex = 10; |
| | | uiFlowLayoutPanel1.Text = "`"; |
| | | uiMCLayoutPanel1.BackColor = Color.FromArgb(32, 41, 50); |
| | | uiMCLayoutPanel1.Dock = DockStyle.Fill; |
| | | uiMCLayoutPanel1.Font = new Font("å®ä½", 12F); |
| | | uiMCLayoutPanel1.ForeColor = SystemColors.Control; |
| | | uiMCLayoutPanel1.Location = new Point(4, 5); |
| | | uiMCLayoutPanel1.Margin = new Padding(4, 5, 4, 5); |
| | | uiMCLayoutPanel1.MinimumSize = new Size(1, 1); |
| | | uiMCLayoutPanel1.Name = "uiMCLayoutPanel1"; |
| | | uiMCLayoutPanel1.Padding = new Padding(2); |
| | | uiMCLayoutPanel1.Size = new Size(599, 293); |
| | | uiMCLayoutPanel1.TabIndex = 10; |
| | | uiMCLayoutPanel1.Text = "`"; |
| | | // |
| | | // tableLayoutPanel1 |
| | | // |
| | | tableLayoutPanel1.ColumnCount = 1; |
| | | tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F)); |
| | | tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 20F)); |
| | | tableLayoutPanel1.Controls.Add(uiFlowLayoutPanel1, 0, 0); |
| | | tableLayoutPanel1.Controls.Add(uiMCLayoutPanel1, 0, 0); |
| | | tableLayoutPanel1.Controls.Add(tableLayoutPanel2, 0, 1); |
| | | tableLayoutPanel1.Dock = DockStyle.Fill; |
| | | tableLayoutPanel1.Location = new Point(0, 0); |
| | |
| | | // |
| | | // MotionControlEditPage |
| | | // |
| | | AutoScaleDimensions = new SizeF(96F, 96F); |
| | | AutoScaleMode = AutoScaleMode.Dpi; |
| | | BackColor = Color.FromArgb(32, 41, 50); |
| | | Controls.Add(tableLayoutPanel1); |
| | | ForeColor = SystemColors.Control; |
| | |
| | | |
| | | private ReaLTaiizor.Controls.HopeButton uiButton1; |
| | | private ReaLTaiizor.Controls.LostButton uiButton2; |
| | | private FlowLayoutPanel uiFlowLayoutPanel1; |
| | | private FlowLayoutPanel uiMCLayoutPanel1; |
| | | private TableLayoutPanel tableLayoutPanel1; |
| | | private TableLayoutPanel tableLayoutPanel2; |
| | | } |
| | |
| | | using LB_VisionControl; |
| | | using LB_SmartVision.Forms.Pages.CameraPage; |
| | | using LB_SmartVision.Forms.Pages.MotionControlPage; |
| | | using LB_VisionControl; |
| | | using LB_VisionProcesses.Cameras; |
| | | using OpenCvSharp.Flann; |
| | | using System; |
| | | using System.Collections.Concurrent; |
| | |
| | | { |
| | | public Action<string, LogInfoType> LogInfo; |
| | | |
| | | |
| | | public MotionControlEditPage() |
| | | { |
| | | InitializeComponent(); |
| | |
| | | |
| | | private void MESEditPage_Paint(object sender, PaintEventArgs e) |
| | | { |
| | | uiFlowLayoutPanel1.Controls.Clear(); |
| | | uiMCLayoutPanel1.Controls.Clear(); |
| | | |
| | | if (GlobalVar.dicCameras.Count <= 0) |
| | | return; |
| | | |
| | | foreach (var item in GlobalVar.dicCameras) |
| | | { |
| | | string CameraSN = item.Key; |
| | | string CameraBrand = item.Value.Brand.ToString(); |
| | | |
| | | if (string.IsNullOrEmpty(CameraSN) || string.IsNullOrEmpty(CameraBrand)) |
| | | return; |
| | | |
| | | UserItem flow = new UserItem(new string[] { "è¿å¨æ§å¶", "å·æ°", "ç§»é¤" }); |
| | | flow.Name = CameraSN; |
| | | flow.Text = $"[{CameraBrand}]"; |
| | | if (item.Value.isGrabbing) |
| | | flow.state = State.Pass; |
| | | else |
| | | flow.state |= State.Error; |
| | | LoadFlowEvent(flow); |
| | | |
| | | uiMCLayoutPanel1.Controls.Add(flow); |
| | | } |
| | | } |
| | | |
| | | private void uiButton1_Click(object sender, System.EventArgs e) |
| | | { |
| | | CreateCameraForm createCameraForm = new CreateCameraForm(); |
| | | createCameraForm.ShowDialog(); |
| | | |
| | | if (createCameraForm.bCreate) |
| | | { |
| | | BaseCamera camera = createCameraForm.camera; |
| | | if (GlobalVar.dicCameras.ContainsKey(camera.SN)) |
| | | { |
| | | MessageBox.Show($"ç¸æº[{camera.SN}]å·²åå¨!", "å¼å¸¸"); |
| | | return; |
| | | } |
| | | |
| | | string CameraSN = camera.SN;//"127.0.0.1" |
| | | string CameraBrand = camera.Brand.ToString();//"1111" |
| | | |
| | | if (string.IsNullOrEmpty(CameraSN) || string.IsNullOrEmpty(CameraBrand)) |
| | | return; |
| | | |
| | | GlobalVar.dicCameras.TryAdd(CameraSN, camera); |
| | | LogInfo?.Invoke(string.Format("æ·»å ç¸æº[{0}][{1}]æå", CameraBrand, CameraSN), LogInfoType.PASS); |
| | | } |
| | | this.Invalidate(); |
| | | } |
| | | |
| | | private void uiButton2_Click(object sender, System.EventArgs e) |
| | | { |
| | | //æ¸
é¤ç¨Clearæ¹æ³ |
| | | uiMCLayoutPanel1.Controls.Clear(); |
| | | foreach (var camera in GlobalVar.dicCameras.Values) |
| | | { |
| | | camera.CloseDevice(); |
| | | } |
| | | GlobalVar.dicCameras.Clear(); |
| | | } |
| | | |
| | | private void LoadFlowEvent(UserItem flow) |
| | | { |
| | | //æé®1为æµè¯ |
| | | flow.MenuItem1ClickedEvent += MCEvent; |
| | | //æé®2ä¸ºå·æ° |
| | | flow.MenuItem2ClickedEvent += ReconnectEvent; |
| | | //æé®3ä¸ºç§»é¤ |
| | | flow.MenuItem3ClickedEvent += DeleteEvent; |
| | | |
| | | } |
| | | |
| | | private void RemoveFlowEvent(UserItem flow) |
| | | { |
| | | //æé®1为æµè¯ |
| | | flow.MenuItem1ClickedEvent -= MCEvent; |
| | | //æé®2ä¸ºå·æ° |
| | | flow.MenuItem2ClickedEvent -= ReconnectEvent; |
| | | //æé®3ä¸ºç§»é¤ |
| | | flow.MenuItem3ClickedEvent -= DeleteEvent; |
| | | } |
| | | |
| | | // è¿å¨æ§å¶ |
| | | private void MCEvent(string Name, string Text) |
| | | { |
| | | for (int i = 0; i < uiMCLayoutPanel1.Controls.Count; i++) |
| | | { |
| | | UserItem flow = (UserItem)uiMCLayoutPanel1.Controls[i]; |
| | | string name = flow.Name; |
| | | if (name != Name) |
| | | continue; |
| | | |
| | | if (GlobalVar.dicCameras.ContainsKey(name)) |
| | | { |
| | | MotionControlPage.MotionControlForm cameraForm = new MotionControlPage.MotionControlForm(GlobalVar.dicCameras[name]); |
| | | cameraForm.Show(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // ç§»é¤ç¸æº |
| | | private void DeleteEvent(string Name, string Text) |
| | | { |
| | | for (int i = 0; i < uiMCLayoutPanel1.Controls.Count; i++) |
| | | { |
| | | UserItem flow = (UserItem)uiMCLayoutPanel1.Controls[i]; |
| | | string name = flow.Name; |
| | | if (name != Name) |
| | | continue; |
| | | |
| | | RemoveFlowEvent(flow); |
| | | uiMCLayoutPanel1.Controls.Remove(uiMCLayoutPanel1.Controls[i]); |
| | | if (GlobalVar.dicCameras.TryRemove(name, out BaseCamera BaseCamera)) |
| | | { |
| | | BaseCamera.Dispose(); |
| | | LogInfo?.Invoke(string.Format("ç§»é¤ç¸æº[{0}]", name), LogInfoType.INFO); |
| | | } |
| | | else |
| | | LogInfo?.Invoke(string.Format("ç§»é¤ç¸æº[{0}]失败", name), LogInfoType.ERROR); |
| | | |
| | | } |
| | | } |
| | | |
| | | // éè¿ç¸æº |
| | | private void ReconnectEvent(string Name, string Text) |
| | | { |
| | | for (int i = 0; i < uiMCLayoutPanel1.Controls.Count; i++) |
| | | { |
| | | UserItem flow = (UserItem)uiMCLayoutPanel1.Controls[i]; |
| | | string name = flow.Name; |
| | | if (name != Name) |
| | | continue; |
| | | |
| | | GlobalVar.dicCameras[name].CloseDevice(); |
| | | Thread.Sleep(50); |
| | | GlobalVar.dicCameras[name].InitDevice(name, this.Handle); |
| | | if (GlobalVar.dicCameras[name].isGrabbing) |
| | | { |
| | | flow.state = State.Pass; |
| | | LogInfo?.Invoke(string.Format("éè¿ç¸æº[{0}]æå", name), LogInfoType.PASS); |
| | | } |
| | | else |
| | | { |
| | | flow.state = State.Error; |
| | | LogInfo?.Invoke(string.Format("éè¿ç¸æº[{0}]失败", name), LogInfoType.ERROR); |
| | | } |
| | | flow.Refresh(); |
| | | } |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace LB_SmartVision.Forms.Pages.MotionControlPage |
| | | { |
| | | partial class MotionControlForm |
| | | { |
| | | /// <summary> |
| | | /// Required designer variable. |
| | | /// </summary> |
| | | private System.ComponentModel.IContainer components = null; |
| | | |
| | | /// <summary> |
| | | /// Clean up any resources being used. |
| | | /// </summary> |
| | | /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> |
| | | protected override void Dispose(bool disposing) |
| | | { |
| | | if (disposing && (components != null)) |
| | | { |
| | | components.Dispose(); |
| | | } |
| | | base.Dispose(disposing); |
| | | } |
| | | |
| | | #region Windows Form Designer generated code |
| | | |
| | | /// <summary> |
| | | /// Required method for Designer support - do not modify |
| | | /// the contents of this method with the code editor. |
| | | /// </summary> |
| | | private void InitializeComponent() |
| | | { |
| | | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MotionControlForm)); |
| | | uiGroupBoxMotionControl = new GroupBox(); |
| | | tableLayoutPanel3 = new TableLayoutPanel(); |
| | | tableLayoutPanel6 = new TableLayoutPanel(); |
| | | uiButtonCloseSoftGrab = new Button(); |
| | | uiButtonHardGrabWithPLC = new Button(); |
| | | tableLayoutPanel5 = new TableLayoutPanel(); |
| | | uiButtonGrabOnce = new Button(); |
| | | tableLayoutPanel4 = new TableLayoutPanel(); |
| | | labelPointSpeed = new Label(); |
| | | textBoxAngleNow = new TextBox(); |
| | | labelAngleNow = new Label(); |
| | | textBoxPositionNow = new TextBox(); |
| | | labelPositionNow = new Label(); |
| | | textBoxAngSpeed = new TextBox(); |
| | | labelAngSpeed = new Label(); |
| | | textBoxPointSpeed = new TextBox(); |
| | | tableLayoutPanel2 = new TableLayoutPanel(); |
| | | uiButtonIncreasePitchAngle = new Button(); |
| | | groupBoxPitchAnglePosition = new GroupBox(); |
| | | textBoxPitchAnglePosition = new TextBox(); |
| | | uiButtonDecreasePitchAngle = new Button(); |
| | | groupBoxZPosition = new GroupBox(); |
| | | textBoxZPosition = new TextBox(); |
| | | groupBoxYPosition = new GroupBox(); |
| | | textBoxYPosition = new TextBox(); |
| | | uiButtonIncreaseZ = new Button(); |
| | | uiButtonDecreaseZ = new Button(); |
| | | uiButtonIncreaseY = new Button(); |
| | | uiButtonDecreaseY = new Button(); |
| | | uiButtonIncreaseX = new Button(); |
| | | uiButtonDecreaseX = new Button(); |
| | | groupBoxXPosition = new GroupBox(); |
| | | textBoxXPosition = new TextBox(); |
| | | tableLayoutPanel1 = new TableLayoutPanel(); |
| | | textBox1 = new TextBox(); |
| | | uiMarkLabelSN = new Label(); |
| | | tableLayoutPanel7 = new TableLayoutPanel(); |
| | | textBox2 = new TextBox(); |
| | | uiMarkLabelName = new Label(); |
| | | uiGroupBoxImage = new GroupBox(); |
| | | uiSplitContainer1 = new SplitContainer(); |
| | | themeForm1 = new ReaLTaiizor.Forms.ThemeForm(); |
| | | controlBox1 = new ReaLTaiizor.Controls.ControlBox(); |
| | | uiGroupBoxMotionControl.SuspendLayout(); |
| | | tableLayoutPanel3.SuspendLayout(); |
| | | tableLayoutPanel6.SuspendLayout(); |
| | | tableLayoutPanel5.SuspendLayout(); |
| | | tableLayoutPanel4.SuspendLayout(); |
| | | tableLayoutPanel2.SuspendLayout(); |
| | | groupBoxPitchAnglePosition.SuspendLayout(); |
| | | groupBoxZPosition.SuspendLayout(); |
| | | groupBoxYPosition.SuspendLayout(); |
| | | groupBoxXPosition.SuspendLayout(); |
| | | tableLayoutPanel1.SuspendLayout(); |
| | | tableLayoutPanel7.SuspendLayout(); |
| | | ((System.ComponentModel.ISupportInitialize)uiSplitContainer1).BeginInit(); |
| | | uiSplitContainer1.Panel1.SuspendLayout(); |
| | | uiSplitContainer1.Panel2.SuspendLayout(); |
| | | uiSplitContainer1.SuspendLayout(); |
| | | themeForm1.SuspendLayout(); |
| | | SuspendLayout(); |
| | | // |
| | | // uiGroupBoxMotionControl |
| | | // |
| | | uiGroupBoxMotionControl.Controls.Add(tableLayoutPanel3); |
| | | uiGroupBoxMotionControl.Font = new Font("å®ä½", 12F); |
| | | uiGroupBoxMotionControl.ForeColor = SystemColors.Control; |
| | | uiGroupBoxMotionControl.Location = new Point(0, 0); |
| | | uiGroupBoxMotionControl.Margin = new Padding(4, 5, 4, 5); |
| | | uiGroupBoxMotionControl.MinimumSize = new Size(1, 1); |
| | | uiGroupBoxMotionControl.Name = "uiGroupBoxMotionControl"; |
| | | uiGroupBoxMotionControl.Padding = new Padding(0, 32, 0, 0); |
| | | uiGroupBoxMotionControl.Size = new Size(374, 624); |
| | | uiGroupBoxMotionControl.TabIndex = 18; |
| | | uiGroupBoxMotionControl.TabStop = false; |
| | | uiGroupBoxMotionControl.Text = "è¿å¨æ§å¶åæ°"; |
| | | // |
| | | // tableLayoutPanel3 |
| | | // |
| | | tableLayoutPanel3.ColumnCount = 1; |
| | | tableLayoutPanel3.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F)); |
| | | tableLayoutPanel3.Controls.Add(tableLayoutPanel6, 0, 3); |
| | | tableLayoutPanel3.Controls.Add(tableLayoutPanel5, 0, 2); |
| | | tableLayoutPanel3.Controls.Add(tableLayoutPanel4, 0, 5); |
| | | tableLayoutPanel3.Controls.Add(tableLayoutPanel2, 0, 4); |
| | | tableLayoutPanel3.Controls.Add(tableLayoutPanel1, 0, 0); |
| | | tableLayoutPanel3.Controls.Add(tableLayoutPanel7, 0, 1); |
| | | tableLayoutPanel3.Location = new Point(0, 55); |
| | | tableLayoutPanel3.Name = "tableLayoutPanel3"; |
| | | tableLayoutPanel3.RowCount = 6; |
| | | tableLayoutPanel3.RowStyles.Add(new RowStyle(SizeType.Absolute, 45F)); |
| | | tableLayoutPanel3.RowStyles.Add(new RowStyle(SizeType.Absolute, 45F)); |
| | | tableLayoutPanel3.RowStyles.Add(new RowStyle(SizeType.Absolute, 45F)); |
| | | tableLayoutPanel3.RowStyles.Add(new RowStyle(SizeType.Absolute, 45F)); |
| | | tableLayoutPanel3.RowStyles.Add(new RowStyle(SizeType.Percent, 50F)); |
| | | tableLayoutPanel3.RowStyles.Add(new RowStyle(SizeType.Percent, 50F)); |
| | | tableLayoutPanel3.Size = new Size(374, 560); |
| | | tableLayoutPanel3.TabIndex = 0; |
| | | tableLayoutPanel3.Paint += tableLayoutPanel3_Paint; |
| | | // |
| | | // tableLayoutPanel6 |
| | | // |
| | | tableLayoutPanel6.ColumnCount = 2; |
| | | tableLayoutPanel6.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); |
| | | tableLayoutPanel6.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); |
| | | tableLayoutPanel6.Controls.Add(uiButtonCloseSoftGrab, 1, 0); |
| | | tableLayoutPanel6.Controls.Add(uiButtonHardGrabWithPLC, 0, 0); |
| | | tableLayoutPanel6.Dock = DockStyle.Fill; |
| | | tableLayoutPanel6.Location = new Point(3, 138); |
| | | tableLayoutPanel6.Name = "tableLayoutPanel6"; |
| | | tableLayoutPanel6.RowCount = 1; |
| | | tableLayoutPanel6.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); |
| | | tableLayoutPanel6.Size = new Size(368, 39); |
| | | tableLayoutPanel6.TabIndex = 6; |
| | | // |
| | | // uiButtonCloseSoftGrab |
| | | // |
| | | uiButtonCloseSoftGrab.Anchor = AnchorStyles.None; |
| | | uiButtonCloseSoftGrab.BackColor = Color.Black; |
| | | uiButtonCloseSoftGrab.Location = new Point(225, 5); |
| | | uiButtonCloseSoftGrab.Name = "uiButtonCloseSoftGrab"; |
| | | uiButtonCloseSoftGrab.Size = new Size(102, 29); |
| | | uiButtonCloseSoftGrab.TabIndex = 2; |
| | | uiButtonCloseSoftGrab.Text = "æåéé"; |
| | | uiButtonCloseSoftGrab.UseVisualStyleBackColor = false; |
| | | // |
| | | // uiButtonHardGrabWithPLC |
| | | // |
| | | uiButtonHardGrabWithPLC.Anchor = AnchorStyles.None; |
| | | uiButtonHardGrabWithPLC.BackColor = Color.Black; |
| | | uiButtonHardGrabWithPLC.Location = new Point(41, 5); |
| | | uiButtonHardGrabWithPLC.Name = "uiButtonHardGrabWithPLC"; |
| | | uiButtonHardGrabWithPLC.Size = new Size(102, 29); |
| | | uiButtonHardGrabWithPLC.TabIndex = 1; |
| | | uiButtonHardGrabWithPLC.Text = "模æéé"; |
| | | uiButtonHardGrabWithPLC.UseVisualStyleBackColor = false; |
| | | uiButtonHardGrabWithPLC.Click += uiButtonHardGrabWithPLC_Click; |
| | | // |
| | | // tableLayoutPanel5 |
| | | // |
| | | tableLayoutPanel5.ColumnCount = 1; |
| | | tableLayoutPanel5.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); |
| | | tableLayoutPanel5.Controls.Add(uiButtonGrabOnce, 0, 0); |
| | | tableLayoutPanel5.Dock = DockStyle.Fill; |
| | | tableLayoutPanel5.Location = new Point(3, 93); |
| | | tableLayoutPanel5.Name = "tableLayoutPanel5"; |
| | | tableLayoutPanel5.RowCount = 1; |
| | | tableLayoutPanel5.RowStyles.Add(new RowStyle(SizeType.Percent, 50F)); |
| | | tableLayoutPanel5.Size = new Size(368, 39); |
| | | tableLayoutPanel5.TabIndex = 5; |
| | | // |
| | | // uiButtonGrabOnce |
| | | // |
| | | uiButtonGrabOnce.BackColor = Color.Black; |
| | | uiButtonGrabOnce.Dock = DockStyle.Fill; |
| | | uiButtonGrabOnce.Location = new Point(3, 3); |
| | | uiButtonGrabOnce.Name = "uiButtonGrabOnce"; |
| | | uiButtonGrabOnce.Size = new Size(362, 33); |
| | | uiButtonGrabOnce.TabIndex = 0; |
| | | uiButtonGrabOnce.Text = "åå¼ éé"; |
| | | uiButtonGrabOnce.UseVisualStyleBackColor = false; |
| | | uiButtonGrabOnce.Click += uiButtonGrabOnce_Click; |
| | | // |
| | | // tableLayoutPanel4 |
| | | // |
| | | tableLayoutPanel4.ColumnCount = 2; |
| | | tableLayoutPanel4.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 42.81768F)); |
| | | tableLayoutPanel4.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 57.18232F)); |
| | | tableLayoutPanel4.Controls.Add(labelPointSpeed, 0, 0); |
| | | tableLayoutPanel4.Controls.Add(textBoxAngleNow, 1, 3); |
| | | tableLayoutPanel4.Controls.Add(labelAngleNow, 0, 3); |
| | | tableLayoutPanel4.Controls.Add(textBoxPositionNow, 1, 2); |
| | | tableLayoutPanel4.Controls.Add(labelPositionNow, 0, 2); |
| | | tableLayoutPanel4.Controls.Add(textBoxAngSpeed, 1, 1); |
| | | tableLayoutPanel4.Controls.Add(labelAngSpeed, 0, 1); |
| | | tableLayoutPanel4.Controls.Add(textBoxPointSpeed, 1, 0); |
| | | tableLayoutPanel4.Dock = DockStyle.Fill; |
| | | tableLayoutPanel4.Location = new Point(3, 373); |
| | | tableLayoutPanel4.Name = "tableLayoutPanel4"; |
| | | tableLayoutPanel4.RowCount = 4; |
| | | tableLayoutPanel4.RowStyles.Add(new RowStyle(SizeType.Absolute, 45F)); |
| | | tableLayoutPanel4.RowStyles.Add(new RowStyle(SizeType.Absolute, 45F)); |
| | | tableLayoutPanel4.RowStyles.Add(new RowStyle(SizeType.Absolute, 45F)); |
| | | tableLayoutPanel4.RowStyles.Add(new RowStyle(SizeType.Absolute, 45F)); |
| | | tableLayoutPanel4.Size = new Size(368, 184); |
| | | tableLayoutPanel4.TabIndex = 2; |
| | | // |
| | | // labelPointSpeed |
| | | // |
| | | labelPointSpeed.AutoSize = true; |
| | | labelPointSpeed.Dock = DockStyle.Fill; |
| | | labelPointSpeed.Location = new Point(3, 5); |
| | | labelPointSpeed.Margin = new Padding(3, 5, 3, 5); |
| | | labelPointSpeed.Name = "labelPointSpeed"; |
| | | labelPointSpeed.Size = new Size(151, 35); |
| | | labelPointSpeed.TabIndex = 18; |
| | | labelPointSpeed.Text = "ç¹å¨é度(mm/s)"; |
| | | labelPointSpeed.TextAlign = ContentAlignment.MiddleLeft; |
| | | // |
| | | // textBoxAngleNow |
| | | // |
| | | textBoxAngleNow.Anchor = AnchorStyles.Left | AnchorStyles.Right; |
| | | textBoxAngleNow.Enabled = false; |
| | | textBoxAngleNow.Location = new Point(160, 144); |
| | | textBoxAngleNow.Name = "textBoxAngleNow"; |
| | | textBoxAngleNow.Size = new Size(205, 30); |
| | | textBoxAngleNow.TabIndex = 17; |
| | | textBoxAngleNow.Text = "0"; |
| | | textBoxAngleNow.TextChanged += textBoxAngleNow_TextChanged; |
| | | // |
| | | // labelAngleNow |
| | | // |
| | | labelAngleNow.AutoSize = true; |
| | | labelAngleNow.Dock = DockStyle.Fill; |
| | | labelAngleNow.Location = new Point(3, 140); |
| | | labelAngleNow.Margin = new Padding(3, 5, 3, 5); |
| | | labelAngleNow.Name = "labelAngleNow"; |
| | | labelAngleNow.Size = new Size(151, 39); |
| | | labelAngleNow.TabIndex = 16; |
| | | labelAngleNow.Text = "å½åè§åº¦(°)"; |
| | | labelAngleNow.TextAlign = ContentAlignment.MiddleLeft; |
| | | // |
| | | // textBoxPositionNow |
| | | // |
| | | textBoxPositionNow.Anchor = AnchorStyles.Left | AnchorStyles.Right; |
| | | textBoxPositionNow.Enabled = false; |
| | | textBoxPositionNow.Location = new Point(160, 97); |
| | | textBoxPositionNow.Name = "textBoxPositionNow"; |
| | | textBoxPositionNow.Size = new Size(205, 30); |
| | | textBoxPositionNow.TabIndex = 15; |
| | | textBoxPositionNow.Text = "(0,0,0)"; |
| | | textBoxPositionNow.TextChanged += textBoxPositionNow_TextChanged; |
| | | // |
| | | // labelPositionNow |
| | | // |
| | | labelPositionNow.AutoSize = true; |
| | | labelPositionNow.Dock = DockStyle.Fill; |
| | | labelPositionNow.Location = new Point(3, 95); |
| | | labelPositionNow.Margin = new Padding(3, 5, 3, 5); |
| | | labelPositionNow.Name = "labelPositionNow"; |
| | | labelPositionNow.Size = new Size(151, 35); |
| | | labelPositionNow.TabIndex = 14; |
| | | labelPositionNow.Text = "å½åç¹ä½(mm)"; |
| | | labelPositionNow.TextAlign = ContentAlignment.MiddleLeft; |
| | | // |
| | | // textBoxAngSpeed |
| | | // |
| | | textBoxAngSpeed.Anchor = AnchorStyles.Left | AnchorStyles.Right; |
| | | textBoxAngSpeed.Location = new Point(160, 52); |
| | | textBoxAngSpeed.Name = "textBoxAngSpeed"; |
| | | textBoxAngSpeed.Size = new Size(205, 30); |
| | | textBoxAngSpeed.TabIndex = 13; |
| | | textBoxAngSpeed.Text = "0"; |
| | | textBoxAngSpeed.TextChanged += textBoxAngSpeed_TextChanged; |
| | | textBoxAngSpeed.KeyDown += textBoxXPosition_KeyDown; |
| | | textBoxAngSpeed.KeyPress += textBoxXPosition_KeyPress; |
| | | // |
| | | // labelAngSpeed |
| | | // |
| | | labelAngSpeed.AutoSize = true; |
| | | labelAngSpeed.Dock = DockStyle.Fill; |
| | | labelAngSpeed.Location = new Point(3, 50); |
| | | labelAngSpeed.Margin = new Padding(3, 5, 3, 5); |
| | | labelAngSpeed.Name = "labelAngSpeed"; |
| | | labelAngSpeed.Size = new Size(151, 35); |
| | | labelAngSpeed.TabIndex = 12; |
| | | labelAngSpeed.Text = "è§é度(rad/s)"; |
| | | labelAngSpeed.TextAlign = ContentAlignment.MiddleLeft; |
| | | // |
| | | // textBoxPointSpeed |
| | | // |
| | | textBoxPointSpeed.Anchor = AnchorStyles.Left | AnchorStyles.Right; |
| | | textBoxPointSpeed.Location = new Point(160, 7); |
| | | textBoxPointSpeed.Name = "textBoxPointSpeed"; |
| | | textBoxPointSpeed.Size = new Size(205, 30); |
| | | textBoxPointSpeed.TabIndex = 11; |
| | | textBoxPointSpeed.Text = "0"; |
| | | textBoxPointSpeed.TextChanged += textBoxPointSpeed_TextChanged; |
| | | textBoxPointSpeed.KeyDown += textBoxXPosition_KeyDown; |
| | | textBoxPointSpeed.KeyPress += textBoxXPosition_KeyPress; |
| | | // |
| | | // tableLayoutPanel2 |
| | | // |
| | | tableLayoutPanel2.ColumnCount = 3; |
| | | tableLayoutPanel2.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F)); |
| | | tableLayoutPanel2.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 60F)); |
| | | tableLayoutPanel2.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F)); |
| | | tableLayoutPanel2.Controls.Add(uiButtonIncreasePitchAngle, 2, 3); |
| | | tableLayoutPanel2.Controls.Add(groupBoxPitchAnglePosition, 1, 3); |
| | | tableLayoutPanel2.Controls.Add(uiButtonDecreasePitchAngle, 0, 3); |
| | | tableLayoutPanel2.Controls.Add(groupBoxZPosition, 1, 2); |
| | | tableLayoutPanel2.Controls.Add(groupBoxYPosition, 1, 1); |
| | | tableLayoutPanel2.Controls.Add(uiButtonIncreaseZ, 2, 2); |
| | | tableLayoutPanel2.Controls.Add(uiButtonDecreaseZ, 0, 2); |
| | | tableLayoutPanel2.Controls.Add(uiButtonIncreaseY, 2, 1); |
| | | tableLayoutPanel2.Controls.Add(uiButtonDecreaseY, 0, 1); |
| | | tableLayoutPanel2.Controls.Add(uiButtonIncreaseX, 2, 0); |
| | | tableLayoutPanel2.Controls.Add(uiButtonDecreaseX, 0, 0); |
| | | tableLayoutPanel2.Controls.Add(groupBoxXPosition, 1, 0); |
| | | tableLayoutPanel2.Dock = DockStyle.Fill; |
| | | tableLayoutPanel2.Location = new Point(3, 183); |
| | | tableLayoutPanel2.Name = "tableLayoutPanel2"; |
| | | tableLayoutPanel2.RowCount = 1; |
| | | tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Absolute, 45F)); |
| | | tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Absolute, 45F)); |
| | | tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Absolute, 45F)); |
| | | tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Absolute, 45F)); |
| | | tableLayoutPanel2.Size = new Size(368, 184); |
| | | tableLayoutPanel2.TabIndex = 3; |
| | | // |
| | | // uiButtonIncreasePitchAngle |
| | | // |
| | | uiButtonIncreasePitchAngle.BackColor = Color.Black; |
| | | uiButtonIncreasePitchAngle.Dock = DockStyle.Left; |
| | | uiButtonIncreasePitchAngle.Location = new Point(298, 140); |
| | | uiButtonIncreasePitchAngle.Margin = new Padding(5); |
| | | uiButtonIncreasePitchAngle.Name = "uiButtonIncreasePitchAngle"; |
| | | uiButtonIncreasePitchAngle.Size = new Size(32, 39); |
| | | uiButtonIncreasePitchAngle.TabIndex = 27; |
| | | uiButtonIncreasePitchAngle.Text = "+"; |
| | | uiButtonIncreasePitchAngle.UseVisualStyleBackColor = false; |
| | | uiButtonIncreasePitchAngle.Click += uiButtonIncreasePitchAngle_Click; |
| | | // |
| | | // groupBoxPitchAnglePosition |
| | | // |
| | | groupBoxPitchAnglePosition.Controls.Add(textBoxPitchAnglePosition); |
| | | groupBoxPitchAnglePosition.Font = new Font("å®ä½", 8F); |
| | | groupBoxPitchAnglePosition.ForeColor = Color.White; |
| | | groupBoxPitchAnglePosition.Location = new Point(123, 138); |
| | | groupBoxPitchAnglePosition.Margin = new Padding(50, 3, 3, 3); |
| | | groupBoxPitchAnglePosition.Name = "groupBoxPitchAnglePosition"; |
| | | groupBoxPitchAnglePosition.Size = new Size(115, 39); |
| | | groupBoxPitchAnglePosition.TabIndex = 26; |
| | | groupBoxPitchAnglePosition.TabStop = false; |
| | | groupBoxPitchAnglePosition.Text = "俯仰è§(°)"; |
| | | // |
| | | // textBoxPitchAnglePosition |
| | | // |
| | | textBoxPitchAnglePosition.Dock = DockStyle.Bottom; |
| | | textBoxPitchAnglePosition.Font = new Font("å®ä½", 10F); |
| | | textBoxPitchAnglePosition.Location = new Point(3, 16); |
| | | textBoxPitchAnglePosition.Multiline = true; |
| | | textBoxPitchAnglePosition.Name = "textBoxPitchAnglePosition"; |
| | | textBoxPitchAnglePosition.Size = new Size(109, 20); |
| | | textBoxPitchAnglePosition.TabIndex = 13; |
| | | textBoxPitchAnglePosition.Text = "1"; |
| | | textBoxPitchAnglePosition.KeyDown += textBoxXPosition_KeyDown; |
| | | textBoxPitchAnglePosition.KeyPress += textBoxXPosition_KeyPress; |
| | | // |
| | | // uiButtonDecreasePitchAngle |
| | | // |
| | | uiButtonDecreasePitchAngle.BackColor = Color.Black; |
| | | uiButtonDecreasePitchAngle.Dock = DockStyle.Right; |
| | | uiButtonDecreasePitchAngle.Location = new Point(37, 140); |
| | | uiButtonDecreasePitchAngle.Margin = new Padding(5); |
| | | uiButtonDecreasePitchAngle.Name = "uiButtonDecreasePitchAngle"; |
| | | uiButtonDecreasePitchAngle.Size = new Size(31, 39); |
| | | uiButtonDecreasePitchAngle.TabIndex = 25; |
| | | uiButtonDecreasePitchAngle.Text = "-"; |
| | | uiButtonDecreasePitchAngle.UseVisualStyleBackColor = false; |
| | | uiButtonDecreasePitchAngle.Click += uiButtonDecreasePitchAngle_Click; |
| | | // |
| | | // groupBoxZPosition |
| | | // |
| | | groupBoxZPosition.Controls.Add(textBoxZPosition); |
| | | groupBoxZPosition.Font = new Font("å®ä½", 8F); |
| | | groupBoxZPosition.ForeColor = Color.White; |
| | | groupBoxZPosition.Location = new Point(123, 93); |
| | | groupBoxZPosition.Margin = new Padding(50, 3, 3, 3); |
| | | groupBoxZPosition.Name = "groupBoxZPosition"; |
| | | groupBoxZPosition.Size = new Size(115, 39); |
| | | groupBoxZPosition.TabIndex = 24; |
| | | groupBoxZPosition.TabStop = false; |
| | | groupBoxZPosition.Text = "Z(mm)"; |
| | | // |
| | | // textBoxZPosition |
| | | // |
| | | textBoxZPosition.Dock = DockStyle.Bottom; |
| | | textBoxZPosition.Font = new Font("å®ä½", 10F); |
| | | textBoxZPosition.Location = new Point(3, 16); |
| | | textBoxZPosition.Multiline = true; |
| | | textBoxZPosition.Name = "textBoxZPosition"; |
| | | textBoxZPosition.Size = new Size(109, 20); |
| | | textBoxZPosition.TabIndex = 13; |
| | | textBoxZPosition.Text = "1"; |
| | | textBoxZPosition.KeyDown += textBoxXPosition_KeyDown; |
| | | textBoxZPosition.KeyPress += textBoxXPosition_KeyPress; |
| | | // |
| | | // groupBoxYPosition |
| | | // |
| | | groupBoxYPosition.Controls.Add(textBoxYPosition); |
| | | groupBoxYPosition.Font = new Font("å®ä½", 8F); |
| | | groupBoxYPosition.ForeColor = Color.White; |
| | | groupBoxYPosition.Location = new Point(123, 48); |
| | | groupBoxYPosition.Margin = new Padding(50, 3, 3, 3); |
| | | groupBoxYPosition.Name = "groupBoxYPosition"; |
| | | groupBoxYPosition.Size = new Size(115, 39); |
| | | groupBoxYPosition.TabIndex = 23; |
| | | groupBoxYPosition.TabStop = false; |
| | | groupBoxYPosition.Text = "Y(mm)"; |
| | | // |
| | | // textBoxYPosition |
| | | // |
| | | textBoxYPosition.Dock = DockStyle.Bottom; |
| | | textBoxYPosition.Font = new Font("å®ä½", 10F); |
| | | textBoxYPosition.Location = new Point(3, 16); |
| | | textBoxYPosition.Multiline = true; |
| | | textBoxYPosition.Name = "textBoxYPosition"; |
| | | textBoxYPosition.Size = new Size(109, 20); |
| | | textBoxYPosition.TabIndex = 13; |
| | | textBoxYPosition.Text = "1"; |
| | | textBoxYPosition.KeyDown += textBoxXPosition_KeyDown; |
| | | textBoxYPosition.KeyPress += textBoxXPosition_KeyPress; |
| | | // |
| | | // uiButtonIncreaseZ |
| | | // |
| | | uiButtonIncreaseZ.BackColor = Color.Black; |
| | | uiButtonIncreaseZ.Dock = DockStyle.Left; |
| | | uiButtonIncreaseZ.Location = new Point(298, 95); |
| | | uiButtonIncreaseZ.Margin = new Padding(5); |
| | | uiButtonIncreaseZ.Name = "uiButtonIncreaseZ"; |
| | | uiButtonIncreaseZ.Size = new Size(32, 35); |
| | | uiButtonIncreaseZ.TabIndex = 19; |
| | | uiButtonIncreaseZ.Text = "+"; |
| | | uiButtonIncreaseZ.UseVisualStyleBackColor = false; |
| | | uiButtonIncreaseZ.Click += uiButtonIncreaseZ_Click; |
| | | // |
| | | // uiButtonDecreaseZ |
| | | // |
| | | uiButtonDecreaseZ.BackColor = Color.Black; |
| | | uiButtonDecreaseZ.Dock = DockStyle.Right; |
| | | uiButtonDecreaseZ.Location = new Point(37, 95); |
| | | uiButtonDecreaseZ.Margin = new Padding(5); |
| | | uiButtonDecreaseZ.Name = "uiButtonDecreaseZ"; |
| | | uiButtonDecreaseZ.Size = new Size(31, 35); |
| | | uiButtonDecreaseZ.TabIndex = 17; |
| | | uiButtonDecreaseZ.Text = "-"; |
| | | uiButtonDecreaseZ.UseVisualStyleBackColor = false; |
| | | uiButtonDecreaseZ.Click += uiButtonDecreaseZ_Click; |
| | | // |
| | | // uiButtonIncreaseY |
| | | // |
| | | uiButtonIncreaseY.BackColor = Color.Black; |
| | | uiButtonIncreaseY.Dock = DockStyle.Left; |
| | | uiButtonIncreaseY.Location = new Point(298, 50); |
| | | uiButtonIncreaseY.Margin = new Padding(5); |
| | | uiButtonIncreaseY.Name = "uiButtonIncreaseY"; |
| | | uiButtonIncreaseY.Size = new Size(32, 35); |
| | | uiButtonIncreaseY.TabIndex = 16; |
| | | uiButtonIncreaseY.Text = "+"; |
| | | uiButtonIncreaseY.UseVisualStyleBackColor = false; |
| | | uiButtonIncreaseY.Click += uiButtonIncreaseY_Click; |
| | | // |
| | | // uiButtonDecreaseY |
| | | // |
| | | uiButtonDecreaseY.BackColor = Color.Black; |
| | | uiButtonDecreaseY.Dock = DockStyle.Right; |
| | | uiButtonDecreaseY.Location = new Point(37, 50); |
| | | uiButtonDecreaseY.Margin = new Padding(5); |
| | | uiButtonDecreaseY.Name = "uiButtonDecreaseY"; |
| | | uiButtonDecreaseY.Size = new Size(31, 35); |
| | | uiButtonDecreaseY.TabIndex = 14; |
| | | uiButtonDecreaseY.Text = "-"; |
| | | uiButtonDecreaseY.UseVisualStyleBackColor = false; |
| | | uiButtonDecreaseY.Click += uiButtonDecreaseY_Click; |
| | | // |
| | | // uiButtonIncreaseX |
| | | // |
| | | uiButtonIncreaseX.BackColor = Color.Black; |
| | | uiButtonIncreaseX.Dock = DockStyle.Left; |
| | | uiButtonIncreaseX.Location = new Point(298, 5); |
| | | uiButtonIncreaseX.Margin = new Padding(5); |
| | | uiButtonIncreaseX.Name = "uiButtonIncreaseX"; |
| | | uiButtonIncreaseX.Size = new Size(32, 35); |
| | | uiButtonIncreaseX.TabIndex = 10; |
| | | uiButtonIncreaseX.Text = "+"; |
| | | uiButtonIncreaseX.UseVisualStyleBackColor = false; |
| | | uiButtonIncreaseX.Click += uiButtonIncreaseX_Click; |
| | | // |
| | | // uiButtonDecreaseX |
| | | // |
| | | uiButtonDecreaseX.BackColor = Color.Black; |
| | | uiButtonDecreaseX.Dock = DockStyle.Right; |
| | | uiButtonDecreaseX.Location = new Point(37, 5); |
| | | uiButtonDecreaseX.Margin = new Padding(5); |
| | | uiButtonDecreaseX.Name = "uiButtonDecreaseX"; |
| | | uiButtonDecreaseX.Size = new Size(31, 35); |
| | | uiButtonDecreaseX.TabIndex = 8; |
| | | uiButtonDecreaseX.Text = "-"; |
| | | uiButtonDecreaseX.UseVisualStyleBackColor = false; |
| | | uiButtonDecreaseX.Click += uiButtonDecreaseX_Click; |
| | | // |
| | | // groupBoxXPosition |
| | | // |
| | | groupBoxXPosition.Controls.Add(textBoxXPosition); |
| | | groupBoxXPosition.Font = new Font("å®ä½", 8F); |
| | | groupBoxXPosition.ForeColor = Color.White; |
| | | groupBoxXPosition.Location = new Point(123, 3); |
| | | groupBoxXPosition.Margin = new Padding(50, 3, 3, 3); |
| | | groupBoxXPosition.Name = "groupBoxXPosition"; |
| | | groupBoxXPosition.Size = new Size(115, 39); |
| | | groupBoxXPosition.TabIndex = 21; |
| | | groupBoxXPosition.TabStop = false; |
| | | groupBoxXPosition.Text = "X(mm)"; |
| | | // |
| | | // textBoxXPosition |
| | | // |
| | | textBoxXPosition.Dock = DockStyle.Bottom; |
| | | textBoxXPosition.Font = new Font("å®ä½", 10F); |
| | | textBoxXPosition.Location = new Point(3, 16); |
| | | textBoxXPosition.Multiline = true; |
| | | textBoxXPosition.Name = "textBoxXPosition"; |
| | | textBoxXPosition.Size = new Size(109, 20); |
| | | textBoxXPosition.TabIndex = 12; |
| | | textBoxXPosition.Text = "1"; |
| | | textBoxXPosition.KeyDown += textBoxXPosition_KeyDown; |
| | | textBoxXPosition.KeyPress += textBoxXPosition_KeyPress; |
| | | // |
| | | // tableLayoutPanel1 |
| | | // |
| | | tableLayoutPanel1.ColumnCount = 2; |
| | | tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 75F)); |
| | | tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F)); |
| | | tableLayoutPanel1.Controls.Add(textBox1, 1, 0); |
| | | tableLayoutPanel1.Controls.Add(uiMarkLabelSN, 0, 0); |
| | | tableLayoutPanel1.Dock = DockStyle.Fill; |
| | | tableLayoutPanel1.Location = new Point(3, 3); |
| | | tableLayoutPanel1.Name = "tableLayoutPanel1"; |
| | | tableLayoutPanel1.RowCount = 1; |
| | | tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); |
| | | tableLayoutPanel1.Size = new Size(368, 39); |
| | | tableLayoutPanel1.TabIndex = 4; |
| | | // |
| | | // textBox1 |
| | | // |
| | | textBox1.Anchor = AnchorStyles.Left | AnchorStyles.Right; |
| | | textBox1.Enabled = false; |
| | | textBox1.Location = new Point(78, 4); |
| | | textBox1.Name = "textBox1"; |
| | | textBox1.Size = new Size(287, 30); |
| | | textBox1.TabIndex = 20; |
| | | // |
| | | // uiMarkLabelSN |
| | | // |
| | | uiMarkLabelSN.AutoSize = true; |
| | | uiMarkLabelSN.Dock = DockStyle.Fill; |
| | | uiMarkLabelSN.Location = new Point(3, 5); |
| | | uiMarkLabelSN.Margin = new Padding(3, 5, 3, 5); |
| | | uiMarkLabelSN.Name = "uiMarkLabelSN"; |
| | | uiMarkLabelSN.Size = new Size(69, 29); |
| | | uiMarkLabelSN.TabIndex = 19; |
| | | uiMarkLabelSN.Text = "SN"; |
| | | uiMarkLabelSN.TextAlign = ContentAlignment.MiddleLeft; |
| | | // |
| | | // tableLayoutPanel7 |
| | | // |
| | | tableLayoutPanel7.ColumnCount = 2; |
| | | tableLayoutPanel7.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 75F)); |
| | | tableLayoutPanel7.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F)); |
| | | tableLayoutPanel7.Controls.Add(textBox2, 1, 0); |
| | | tableLayoutPanel7.Controls.Add(uiMarkLabelName, 0, 0); |
| | | tableLayoutPanel7.Dock = DockStyle.Fill; |
| | | tableLayoutPanel7.Location = new Point(3, 48); |
| | | tableLayoutPanel7.Name = "tableLayoutPanel7"; |
| | | tableLayoutPanel7.RowCount = 1; |
| | | tableLayoutPanel7.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); |
| | | tableLayoutPanel7.Size = new Size(368, 39); |
| | | tableLayoutPanel7.TabIndex = 7; |
| | | // |
| | | // textBox2 |
| | | // |
| | | textBox2.Anchor = AnchorStyles.Left | AnchorStyles.Right; |
| | | textBox2.Enabled = false; |
| | | textBox2.Location = new Point(78, 4); |
| | | textBox2.Name = "textBox2"; |
| | | textBox2.Size = new Size(287, 30); |
| | | textBox2.TabIndex = 21; |
| | | // |
| | | // uiMarkLabelName |
| | | // |
| | | uiMarkLabelName.Anchor = AnchorStyles.None; |
| | | uiMarkLabelName.Location = new Point(3, 5); |
| | | uiMarkLabelName.Margin = new Padding(3, 5, 3, 5); |
| | | uiMarkLabelName.Name = "uiMarkLabelName"; |
| | | uiMarkLabelName.Size = new Size(69, 29); |
| | | uiMarkLabelName.TabIndex = 20; |
| | | uiMarkLabelName.Text = "åç§°"; |
| | | uiMarkLabelName.TextAlign = ContentAlignment.MiddleLeft; |
| | | uiMarkLabelName.Click += label1_Click; |
| | | // |
| | | // uiGroupBoxImage |
| | | // |
| | | uiGroupBoxImage.Dock = DockStyle.Fill; |
| | | uiGroupBoxImage.Font = new Font("å®ä½", 12F); |
| | | uiGroupBoxImage.ForeColor = SystemColors.Control; |
| | | uiGroupBoxImage.Location = new Point(0, 0); |
| | | uiGroupBoxImage.Margin = new Padding(4, 5, 4, 5); |
| | | uiGroupBoxImage.MinimumSize = new Size(1, 1); |
| | | uiGroupBoxImage.Name = "uiGroupBoxImage"; |
| | | uiGroupBoxImage.Padding = new Padding(0, 32, 0, 0); |
| | | uiGroupBoxImage.Size = new Size(495, 684); |
| | | uiGroupBoxImage.TabIndex = 17; |
| | | uiGroupBoxImage.TabStop = false; |
| | | uiGroupBoxImage.Text = "宿¶éé"; |
| | | // |
| | | // uiSplitContainer1 |
| | | // |
| | | uiSplitContainer1.Dock = DockStyle.Fill; |
| | | uiSplitContainer1.ForeColor = SystemColors.Control; |
| | | uiSplitContainer1.Location = new Point(10, 70); |
| | | uiSplitContainer1.MinimumSize = new Size(20, 20); |
| | | uiSplitContainer1.Name = "uiSplitContainer1"; |
| | | // |
| | | // uiSplitContainer1.Panel1 |
| | | // |
| | | uiSplitContainer1.Panel1.Controls.Add(uiGroupBoxMotionControl); |
| | | uiSplitContainer1.Panel1.Paint += uiSplitContainer1_Panel1_Paint; |
| | | // |
| | | // uiSplitContainer1.Panel2 |
| | | // |
| | | uiSplitContainer1.Panel2.Controls.Add(uiGroupBoxImage); |
| | | uiSplitContainer1.Size = new Size(880, 684); |
| | | uiSplitContainer1.SplitterDistance = 374; |
| | | uiSplitContainer1.SplitterWidth = 11; |
| | | uiSplitContainer1.TabIndex = 20; |
| | | // |
| | | // themeForm1 |
| | | // |
| | | themeForm1.BackColor = Color.FromArgb(32, 41, 50); |
| | | themeForm1.Controls.Add(controlBox1); |
| | | themeForm1.Controls.Add(uiSplitContainer1); |
| | | themeForm1.Dock = DockStyle.Fill; |
| | | themeForm1.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 0); |
| | | themeForm1.Image = (Image)resources.GetObject("themeForm1.Image"); |
| | | themeForm1.Location = new Point(0, 0); |
| | | themeForm1.Name = "themeForm1"; |
| | | themeForm1.Padding = new Padding(10, 70, 10, 9); |
| | | themeForm1.RoundCorners = true; |
| | | themeForm1.Sizable = true; |
| | | themeForm1.Size = new Size(900, 763); |
| | | themeForm1.SmartBounds = true; |
| | | themeForm1.StartPosition = FormStartPosition.WindowsDefaultLocation; |
| | | themeForm1.TabIndex = 21; |
| | | themeForm1.Text = "è¿å¨æ§å¶è®¾ç½®"; |
| | | // |
| | | // controlBox1 |
| | | // |
| | | controlBox1.Anchor = AnchorStyles.Top | AnchorStyles.Right; |
| | | controlBox1.BackColor = Color.FromArgb(32, 34, 37); |
| | | controlBox1.CloseHoverColor = Color.FromArgb(230, 17, 35); |
| | | controlBox1.DefaultLocation = true; |
| | | controlBox1.EnableHoverHighlight = true; |
| | | controlBox1.EnableMaximizeButton = true; |
| | | controlBox1.EnableMinimizeButton = true; |
| | | controlBox1.ForeColor = Color.FromArgb(155, 155, 155); |
| | | controlBox1.Location = new Point(800, 18); |
| | | controlBox1.MaximizeHoverColor = Color.FromArgb(74, 74, 74); |
| | | controlBox1.MinimizeHoverColor = Color.FromArgb(63, 63, 65); |
| | | controlBox1.Name = "controlBox1"; |
| | | controlBox1.Size = new Size(90, 25); |
| | | controlBox1.TabIndex = 21; |
| | | controlBox1.Text = "controlBox1"; |
| | | // |
| | | // MotionControlForm |
| | | // |
| | | AutoScaleDimensions = new SizeF(120F, 120F); |
| | | AutoScaleMode = AutoScaleMode.Dpi; |
| | | AutoSize = true; |
| | | ClientSize = new Size(900, 763); |
| | | Controls.Add(themeForm1); |
| | | FormBorderStyle = FormBorderStyle.None; |
| | | MinimumSize = new Size(261, 61); |
| | | Name = "MotionControlForm"; |
| | | Text = "è¿å¨æ§å¶è®¾ç½®"; |
| | | TransparencyKey = Color.Fuchsia; |
| | | uiGroupBoxMotionControl.ResumeLayout(false); |
| | | tableLayoutPanel3.ResumeLayout(false); |
| | | tableLayoutPanel6.ResumeLayout(false); |
| | | tableLayoutPanel5.ResumeLayout(false); |
| | | tableLayoutPanel4.ResumeLayout(false); |
| | | tableLayoutPanel4.PerformLayout(); |
| | | tableLayoutPanel2.ResumeLayout(false); |
| | | groupBoxPitchAnglePosition.ResumeLayout(false); |
| | | groupBoxPitchAnglePosition.PerformLayout(); |
| | | groupBoxZPosition.ResumeLayout(false); |
| | | groupBoxZPosition.PerformLayout(); |
| | | groupBoxYPosition.ResumeLayout(false); |
| | | groupBoxYPosition.PerformLayout(); |
| | | groupBoxXPosition.ResumeLayout(false); |
| | | groupBoxXPosition.PerformLayout(); |
| | | tableLayoutPanel1.ResumeLayout(false); |
| | | tableLayoutPanel1.PerformLayout(); |
| | | tableLayoutPanel7.ResumeLayout(false); |
| | | tableLayoutPanel7.PerformLayout(); |
| | | uiSplitContainer1.Panel1.ResumeLayout(false); |
| | | uiSplitContainer1.Panel2.ResumeLayout(false); |
| | | ((System.ComponentModel.ISupportInitialize)uiSplitContainer1).EndInit(); |
| | | uiSplitContainer1.ResumeLayout(false); |
| | | themeForm1.ResumeLayout(false); |
| | | ResumeLayout(false); |
| | | } |
| | | |
| | | #endregion |
| | | private GroupBox uiGroupBoxImage; |
| | | private GroupBox uiGroupBoxMotionControl; |
| | | private SplitContainer uiSplitContainer1; |
| | | private TableLayoutPanel tableLayoutPanel7; |
| | | private Label uiMarkLabel5; |
| | | private TextBox uiTextBoxPitchAngle; |
| | | |
| | | private ReaLTaiizor.Forms.ThemeForm themeForm1; |
| | | private ReaLTaiizor.Controls.ControlBox controlBox1; |
| | | private TableLayoutPanel tableLayoutPanel3; |
| | | private TableLayoutPanel tableLayoutPanel2; |
| | | private Button uiButtonIncreasePitchAngle; |
| | | private GroupBox groupBoxPitchAnglePosition; |
| | | private TextBox textBoxPitchAnglePosition; |
| | | private Button uiButtonDecreasePitchAngle; |
| | | private GroupBox groupBoxZPosition; |
| | | private TextBox textBoxZPosition; |
| | | private GroupBox groupBoxYPosition; |
| | | private TextBox textBoxYPosition; |
| | | private Button uiButtonIncreaseZ; |
| | | private Button uiButtonDecreaseZ; |
| | | private Button uiButtonIncreaseY; |
| | | private Button uiButtonDecreaseY; |
| | | private Button uiButtonIncreaseX; |
| | | private Button uiButtonDecreaseX; |
| | | private GroupBox groupBoxXPosition; |
| | | private TextBox textBoxXPosition; |
| | | private TableLayoutPanel tableLayoutPanel4; |
| | | private Label labelPointSpeed; |
| | | private TextBox textBoxAngleNow; |
| | | private Label labelAngleNow; |
| | | private TextBox textBoxPositionNow; |
| | | private Label labelPositionNow; |
| | | private TextBox textBoxAngSpeed; |
| | | private Label labelAngSpeed; |
| | | private TextBox textBoxPointSpeed; |
| | | private TableLayoutPanel tableLayoutPanel6; |
| | | private Button uiButtonHardGrabWithPLC; |
| | | private TableLayoutPanel tableLayoutPanel5; |
| | | private Button uiButtonGrabOnce; |
| | | private TableLayoutPanel tableLayoutPanel1; |
| | | private TextBox textBox1; |
| | | private Label uiMarkLabelSN; |
| | | private Button uiButtonCloseSoftGrab; |
| | | private Label uiMarkLabelName; |
| | | private TextBox textBox2; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using LB_VisionControl; |
| | | using LB_VisionProcesses.Cameras; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Data; |
| | | using System.Diagnostics; |
| | | using System.Drawing; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Text.RegularExpressions; |
| | | using System.Threading.Tasks; |
| | | using System.Windows; |
| | | using System.Windows.Forms; |
| | | using static ZXing.QrCode.Internal.Mode; |
| | | |
| | | namespace LB_SmartVision.Forms.Pages.MotionControlPage |
| | | { |
| | | public partial class MotionControlForm : Form |
| | | { |
| | | BaseCamera camera { get; set; } |
| | | UserPictureBox onlinePictureBox { get; set; } |
| | | public MotionControlForm() |
| | | { |
| | | InitializeComponent(); |
| | | } |
| | | |
| | | public MotionControlForm(BaseCamera camera) |
| | | { |
| | | InitializeComponent(); |
| | | |
| | | if (camera == null) |
| | | return; |
| | | |
| | | this.camera = camera; |
| | | this.Text = camera.SN; |
| | | textBox1.Text = camera.SN; |
| | | |
| | | onlinePictureBox = new UserPictureBox(uiGroupBoxImage); |
| | | this.uiGroupBoxImage.Controls.Clear(); |
| | | this.uiGroupBoxImage.Controls.Add(onlinePictureBox); |
| | | onlinePictureBox.Dock = DockStyle.Fill; |
| | | |
| | | //å è½½åè°å½æ° |
| | | Subscribe(); |
| | | } |
| | | |
| | | private void CameraForm_FormClosing(object sender, FormClosingEventArgs e) |
| | | { |
| | | if (camera == null) |
| | | return; |
| | | |
| | | camera.StopGrabbing(); |
| | | |
| | | camera.StartGrabbing(); |
| | | |
| | | Unsubscribe(); |
| | | } |
| | | |
| | | public void Unsubscribe() |
| | | { |
| | | try |
| | | { |
| | | if (camera == null) |
| | | return; |
| | | //åæ¶åè°å½æ° |
| | | camera.ImageGrabbed -= GetImageBllComplete; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | // è®°å½éè¯¯ä¿¡æ¯ |
| | | Debug.WriteLine($"é误: {ex.Message}"); |
| | | } |
| | | |
| | | } |
| | | |
| | | public void Subscribe() |
| | | { |
| | | try |
| | | { |
| | | if (camera == null) |
| | | return; |
| | | |
| | | //åæ¶åè°å½æ° |
| | | camera.ImageGrabbed -= GetImageBllComplete; |
| | | //å è½½åè°å½æ° |
| | | camera.ImageGrabbed += GetImageBllComplete; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | // è®°å½éè¯¯ä¿¡æ¯ |
| | | Debug.WriteLine($"é误: {ex.Message}"); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ç¸æºåè°è¿è¡ |
| | | /// </summary> |
| | | /// <param name="CCDName"></param> |
| | | /// <param name="image"></param> |
| | | private void GetImageBllComplete(object sender, CameraEventArgs e) |
| | | { |
| | | if (e.Bitmap == null) |
| | | return; |
| | | |
| | | lock (e.Bitmap) |
| | | { |
| | | if (this.InvokeRequired) // æ£æ¥æ¯å¦éè¦å¨UI线ç¨ä¸è°ç¨ |
| | | { |
| | | this.Invoke(new Action(() => |
| | | { |
| | | onlinePictureBox.Image = e.Bitmap; |
| | | })); // éå½è°ç¨èªèº«ï¼ä½è¿æ¬¡å¨UI线ç¨ä¸ |
| | | } |
| | | else |
| | | { |
| | | onlinePictureBox.Image = e.Bitmap; |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void uiButtonGrabOnce_Click(object sender, EventArgs e) |
| | | { |
| | | if (camera == null) |
| | | return; |
| | | |
| | | Task.Factory.StartNew(() => |
| | | { |
| | | camera.SetTriggerMode(TriggerMode.On, TriggerSource.Software); |
| | | DateTime startTime = DateTime.Now; // å½åæ¶é´ |
| | | camera.GetImageWithSoftTrigger(out Bitmap bitmap); |
| | | }); |
| | | } |
| | | |
| | | private void uiButtonCloseSoftGrab_Click(object sender, EventArgs e) |
| | | { |
| | | if (camera == null) |
| | | return; |
| | | |
| | | Task.Factory.StartNew(() => |
| | | { |
| | | camera.StopGrabbing(); |
| | | camera.SetTriggerMode(TriggerMode.On, TriggerSource.Software); |
| | | camera.StartGrabbing(); |
| | | }); |
| | | } |
| | | |
| | | private void uiButtonHardGrabWithPLC_Click(object sender, EventArgs e) |
| | | { |
| | | if (camera == null) |
| | | return; |
| | | |
| | | Task.Factory.StartNew(() => |
| | | { |
| | | camera.SetTriggerMode(TriggerMode.On, TriggerSource.Line0); |
| | | camera.StopGrabbing(); |
| | | camera.StartWith_HardTriggerModel(); |
| | | }); |
| | | } |
| | | |
| | | private void uiButtonDecreaseX_Click(object sender, EventArgs e) |
| | | { |
| | | float xPosition = 0; |
| | | xPosition = float.Parse(textBoxXPosition.Text); |
| | | MovePosition(-xPosition, 0, 0, 0); |
| | | PositionNow(); |
| | | } |
| | | |
| | | private void uiButtonIncreaseX_Click(object sender, EventArgs e) |
| | | { |
| | | float xPosition = 0; |
| | | xPosition = float.Parse(textBoxXPosition.Text); |
| | | MovePosition(xPosition, 0, 0, 0); |
| | | PositionNow(); |
| | | } |
| | | |
| | | private void uiButtonDecreaseY_Click(object sender, EventArgs e) |
| | | { |
| | | float yPosition = 0; |
| | | yPosition = float.Parse(textBoxYPosition.Text); |
| | | MovePosition(0, -yPosition, 0, 0); |
| | | PositionNow(); |
| | | } |
| | | |
| | | private void uiButtonIncreaseY_Click(object sender, EventArgs e) |
| | | { |
| | | float yPosition = 0; |
| | | yPosition = float.Parse(textBoxYPosition.Text); |
| | | MovePosition(0, yPosition, 0, 0); |
| | | PositionNow(); |
| | | } |
| | | |
| | | private void uiButtonDecreaseZ_Click(object sender, EventArgs e) |
| | | { |
| | | float zPosition = 0; |
| | | zPosition = float.Parse(textBoxZPosition.Text); |
| | | MovePosition(0, 0, -zPosition, 0); |
| | | PositionNow(); |
| | | } |
| | | |
| | | private void uiButtonIncreaseZ_Click(object sender, EventArgs e) |
| | | { |
| | | float zPosition = 0; |
| | | zPosition = float.Parse(textBoxZPosition.Text); |
| | | MovePosition(0, 0, zPosition, 0); |
| | | PositionNow(); |
| | | } |
| | | |
| | | private void uiButtonDecreasePitchAngle_Click(object sender, EventArgs e) |
| | | { |
| | | float pitchanglePosition = 0; |
| | | pitchanglePosition = float.Parse(textBoxPitchAnglePosition.Text); |
| | | MovePosition(0, 0, 0, -pitchanglePosition); |
| | | AngNow(); |
| | | } |
| | | |
| | | private void uiButtonIncreasePitchAngle_Click(object sender, EventArgs e) |
| | | { |
| | | float pitchanglePosition = 0; |
| | | pitchanglePosition = float.Parse(textBoxPitchAnglePosition.Text); |
| | | MovePosition(0, 0, 0, pitchanglePosition); |
| | | AngNow(); |
| | | } |
| | | |
| | | public float XPositionDt; |
| | | public float YPositionDt; |
| | | public float ZPositionDt; |
| | | public float AnglePositionDt; |
| | | public void MovePosition(float fDeltaX, float fDeltaY, float fDeltaZ, float fDeltAngle) |
| | | { |
| | | XPositionDt += fDeltaX; |
| | | YPositionDt += fDeltaY; |
| | | ZPositionDt += fDeltaZ; |
| | | AnglePositionDt += fDeltAngle; |
| | | } |
| | | |
| | | private void textBoxPointSpeed_TextChanged(object sender, EventArgs e) |
| | | { |
| | | float pointspeed = 0; |
| | | pointspeed = float.Parse(textBoxPointSpeed.Text); |
| | | } |
| | | |
| | | private void textBoxAngSpeed_TextChanged(object sender, EventArgs e) |
| | | { |
| | | float angspeed = 0; |
| | | angspeed = float.Parse(textBoxAngSpeed.Text); |
| | | } |
| | | |
| | | private void textBoxPositionNow_TextChanged(object sender, EventArgs e) |
| | | { |
| | | textBoxPositionNow.Enabled = false; |
| | | |
| | | string x; |
| | | string y; |
| | | string z; |
| | | x = Convert.ToString(Math.Round(XPositionDt, 3)); |
| | | y = Convert.ToString(Math.Round(YPositionDt, 3)); |
| | | z = Convert.ToString(Math.Round(ZPositionDt, 3)); |
| | | |
| | | textBoxPositionNow.Text = "(" + x + "," + y + "," + z + ")"; |
| | | } |
| | | |
| | | private void textBoxAngleNow_TextChanged(object sender, EventArgs e) |
| | | { |
| | | textBoxAngleNow.Enabled = false; |
| | | |
| | | string ang; |
| | | ang = Convert.ToString(Math.Round(AnglePositionDt, 3)); |
| | | |
| | | textBoxAngleNow.Text = ang; |
| | | } |
| | | |
| | | private void PositionNow() |
| | | { |
| | | string x; |
| | | string y; |
| | | string z; |
| | | x = Convert.ToString(Math.Round(XPositionDt, 3)); |
| | | y = Convert.ToString(Math.Round(YPositionDt, 3)); |
| | | z = Convert.ToString(Math.Round(ZPositionDt, 3)); |
| | | |
| | | textBoxPositionNow.Text = "(" + x + y + z + ")"; |
| | | } |
| | | private void AngNow() |
| | | { |
| | | string ang; |
| | | ang = Convert.ToString(Math.Round(AnglePositionDt, 3)); |
| | | |
| | | textBoxAngleNow.Text = "(" + ang + ")"; |
| | | } |
| | | |
| | | private void uiGroupBoxMotionControl_Enter(object sender, EventArgs e) |
| | | { |
| | | |
| | | } |
| | | |
| | | private void label1_Click(object sender, EventArgs e) |
| | | { |
| | | |
| | | } |
| | | |
| | | private void tableLayoutPanel3_Paint(object sender, PaintEventArgs e) |
| | | { |
| | | |
| | | } |
| | | |
| | | private void uiSplitContainer1_Panel1_Paint(object sender, PaintEventArgs e) |
| | | { |
| | | |
| | | } |
| | | |
| | | // 使ç¨KeyDownäºä»¶æ´éåå¤çåè½¦é® |
| | | private void textBoxXPosition_KeyDown(object sender, KeyEventArgs e) |
| | | { |
| | | if (e.KeyCode == Keys.Enter) |
| | | { |
| | | //// éªè¯è¾å
¥ |
| | | //if (ValidateXPosition()) |
| | | //{ |
| | | // // æ§è¡ç¡®è®¤æä½ |
| | | // ProcessXPosition(); |
| | | //} |
| | | |
| | | // 黿¢ç³»ç»å£°é³å¹¶è®©ææ¬æ¡å¤±å»ç¦ç¹ |
| | | e.SuppressKeyPress = true; |
| | | e.Handled = true; |
| | | |
| | | this.ActiveControl = null; |
| | | } |
| | | } |
| | | |
| | | // 使ç¨KeyPresséªè¯å®æ¶è¾å
¥ |
| | | private void textBoxXPosition_KeyPress(object sender, KeyPressEventArgs e) |
| | | { |
| | | // å
许å车é®ï¼è½ç¶KeyDownä¼å¤çå®ï¼ |
| | | if (e.KeyChar == (char)Keys.Enter) |
| | | return; |
| | | |
| | | // å
è®¸éæ ¼é® |
| | | if (e.KeyChar == (char)Keys.Back) |
| | | return; |
| | | |
| | | // åªå
许æ°å |
| | | if (!char.IsDigit(e.KeyChar)) |
| | | { |
| | | e.Handled = true; // 黿¢è¾å
¥ |
| | | } |
| | | } |
| | | |
| | | // éªè¯æ¹æ³ |
| | | private bool ValidateXPosition() |
| | | { |
| | | if (string.IsNullOrWhiteSpace(textBoxXPosition.Text)) |
| | | return false; |
| | | |
| | | return Regex.IsMatch(textBoxXPosition.Text, @"^\d+$"); |
| | | } |
| | | |
| | | // å¤çç¡®è®¤çæ¹æ³ |
| | | private void ProcessXPosition() |
| | | { |
| | | if (int.TryParse(textBoxXPosition.Text, out int xPosition)) |
| | | { |
| | | // æ§è¡é»è¾ |
| | | //LogInfo?.Invoke($"Xä½ç½®å·²æ´æ°ä¸º: {xPosition}", LogInfoType.INFO); |
| | | } |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <root> |
| | | <!-- |
| | | Microsoft ResX Schema |
| | | |
| | | Version 2.0 |
| | | |
| | | The primary goals of this format is to allow a simple XML format |
| | | that is mostly human readable. The generation and parsing of the |
| | | various data types are done through the TypeConverter classes |
| | | associated with the data types. |
| | | |
| | | Example: |
| | | |
| | | ... ado.net/XML headers & schema ... |
| | | <resheader name="resmimetype">text/microsoft-resx</resheader> |
| | | <resheader name="version">2.0</resheader> |
| | | <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> |
| | | <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> |
| | | <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> |
| | | <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> |
| | | <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> |
| | | <value>[base64 mime encoded serialized .NET Framework object]</value> |
| | | </data> |
| | | <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
| | | <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> |
| | | <comment>This is a comment</comment> |
| | | </data> |
| | | |
| | | There are any number of "resheader" rows that contain simple |
| | | name/value pairs. |
| | | |
| | | Each data row contains a name, and value. The row also contains a |
| | | type or mimetype. Type corresponds to a .NET class that support |
| | | text/value conversion through the TypeConverter architecture. |
| | | Classes that don't support this are serialized and stored with the |
| | | mimetype set. |
| | | |
| | | The mimetype is used for serialized objects, and tells the |
| | | ResXResourceReader how to depersist the object. This is currently not |
| | | extensible. For a given mimetype the value must be set accordingly: |
| | | |
| | | Note - application/x-microsoft.net.object.binary.base64 is the format |
| | | that the ResXResourceWriter will generate, however the reader can |
| | | read any of the formats listed below. |
| | | |
| | | mimetype: application/x-microsoft.net.object.binary.base64 |
| | | value : The object must be serialized with |
| | | : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter |
| | | : and then encoded with base64 encoding. |
| | | |
| | | mimetype: application/x-microsoft.net.object.soap.base64 |
| | | value : The object must be serialized with |
| | | : System.Runtime.Serialization.Formatters.Soap.SoapFormatter |
| | | : and then encoded with base64 encoding. |
| | | |
| | | mimetype: application/x-microsoft.net.object.bytearray.base64 |
| | | value : The object must be serialized into a byte array |
| | | : using a System.ComponentModel.TypeConverter |
| | | : and then encoded with base64 encoding. |
| | | --> |
| | | <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> |
| | | <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> |
| | | <xsd:element name="root" msdata:IsDataSet="true"> |
| | | <xsd:complexType> |
| | | <xsd:choice maxOccurs="unbounded"> |
| | | <xsd:element name="metadata"> |
| | | <xsd:complexType> |
| | | <xsd:sequence> |
| | | <xsd:element name="value" type="xsd:string" minOccurs="0" /> |
| | | </xsd:sequence> |
| | | <xsd:attribute name="name" use="required" type="xsd:string" /> |
| | | <xsd:attribute name="type" type="xsd:string" /> |
| | | <xsd:attribute name="mimetype" type="xsd:string" /> |
| | | <xsd:attribute ref="xml:space" /> |
| | | </xsd:complexType> |
| | | </xsd:element> |
| | | <xsd:element name="assembly"> |
| | | <xsd:complexType> |
| | | <xsd:attribute name="alias" type="xsd:string" /> |
| | | <xsd:attribute name="name" type="xsd:string" /> |
| | | </xsd:complexType> |
| | | </xsd:element> |
| | | <xsd:element name="data"> |
| | | <xsd:complexType> |
| | | <xsd:sequence> |
| | | <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
| | | <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> |
| | | </xsd:sequence> |
| | | <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> |
| | | <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> |
| | | <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> |
| | | <xsd:attribute ref="xml:space" /> |
| | | </xsd:complexType> |
| | | </xsd:element> |
| | | <xsd:element name="resheader"> |
| | | <xsd:complexType> |
| | | <xsd:sequence> |
| | | <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
| | | </xsd:sequence> |
| | | <xsd:attribute name="name" type="xsd:string" use="required" /> |
| | | </xsd:complexType> |
| | | </xsd:element> |
| | | </xsd:choice> |
| | | </xsd:complexType> |
| | | </xsd:element> |
| | | </xsd:schema> |
| | | <resheader name="resmimetype"> |
| | | <value>text/microsoft-resx</value> |
| | | </resheader> |
| | | <resheader name="version"> |
| | | <value>2.0</value> |
| | | </resheader> |
| | | <resheader name="reader"> |
| | | <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
| | | </resheader> |
| | | <resheader name="writer"> |
| | | <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
| | | </resheader> |
| | | <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> |
| | | <data name="themeForm1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
| | | <value> |
| | | iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO |
| | | wgAADsIBFShKgAAAA+JJREFUWEftVkuIHGUQbt34iMEoq2S2q3p3yTJsuqpnJ+L6WBRdwaigohfFgEou |
| | | BkVBUPCBCEG8BXNQ48GLeImCehIJxMsqhsSZruod46K4HtSIGjU+4iOr0c1I9fSsM3/PLNtCPO0H36m/ |
| | | evz/X11VnreKVRTAHPOZumkY6lFwqURws3BwZ8ywTQnuiCP/+iTCzY1qaUPzdm/Atf3PaHre6XPsjyQM |
| | | 2xLGV4XwIyX4QRj+UMK/lPFvJTyhBMeV8IgQvmRJuH4Ko+l5p9UjGBbCJ5RxTgj+VMZmXxKcSAjekHE/ |
| | | NNs5DgaTKLinEQYVO4Trf1mkV81wixLUslPmA3bzF2XcKeP+hWY/u3n0fCXcrQwLyjAvjNsb1dI6N05P |
| | | mFAIHlHG73sEypPgGwnhfpn0zzH7jzddcK4Q7kqfKNMI4a9K+MwBDgbdeF04MBWsFYYdQvhbLlBvfhKT |
| | | f+vMtLfG7C0JJXxKGY67WnvCmPAFGRs7z42boul5AzHBfdK6TjdQtzPGk8oos5F/5Y7sfVvPhg+lp+1h |
| | | 0yIsxARPmtaN78WEl8eEX+SNclxUhne0glUrNrN9zfMGlPAuZTzaQ99FYfwuDv3ruoLvq5bWaQSvZCfL |
| | | GXUYLwrj240Qxtu2lkSN4FpdWfKZH9jb9RQ1Cq62f9sVOlxUxn3KQXnJ0PO8QxU/jBm1h74v7ZniEG9K |
| | | Hdg/quzvXO709k0Y3u08ucGqWgheX862H4XgxbR47SqU8D1X0EXC2VmGizqDz0xPr0kYH9eO360gNe0b |
| | | jWppozB+1kOQEb5MCLa0C64NoeGrhOGrvH6lhK81GiIvnggmrDLzgvTkvwvDA+5wsU4nhG/m9AUoBD/F |
| | | HFzWN4H0XQn2vF8eXN8Z3FAPYasl59oUYjuB+sTImDB+nhfgYQ39STf4fmu1DHtz+oIUgiM1KkWtwcFw |
| | | sOujVT3hrnaL7UQc+hcL5W+sKIXhw0OVjaW0iwnBc47gqIQ45QY32PKRzv8eTguRYM9SS5YouEEZjv37 |
| | | EffbzbjBDdZyxZYQ12EB2qS0bWrJqRVazPDWkojwZbuZrsgZtDJ0iY1g12khEtTicMTvclwn2CKE32YJ |
| | | 7G5PORfZ1HtMCH7MOV4BrQ3XCe92+4onk5Nn2PolDAvWXnuOzAwzo6Nnx4Q3SrojwqfKeMxWMpsXWVs+ |
| | | 2WrfKRdbW1W6Hf0shM/33Y7my4PrleFZIfhAaWjU/e5ivlw+y3S2FySMtynjvcrwsFiLJv/RhPBB2ws1 |
| | | hK2WcBLBFf1qawlplwvxaQlxe786OOU4PBWsjSO85mBlQ8n99r/BisSdAas4FfgHpdEUZpwUX7sAAAAA |
| | | SUVORK5CYII= |
| | | </value> |
| | | </data> |
| | | </root> |
| | |
| | | // controlsPanel |
| | | // |
| | | controlsPanel.Dock = DockStyle.Fill; |
| | | controlsPanel.Location = new Point(0, 0); |
| | | controlsPanel.Name = "controlsPanel"; |
| | | controlsPanel.Size = new Size(803, 478); |
| | | controlsPanel.Size = new Size(640, 480); |
| | | controlsPanel.TabIndex = 0; |
| | | // |
| | | // AllProcessesPage |
| | | // |
| | | //AutoScaleDimensions = new SizeF(7F, 17F); |
| | | //AutoScaleMode = AutoScaleMode.Font; |
| | | Controls.Add(controlsPanel); |
| | | Name = "AllProcessesPage"; |
| | | Size = new Size(803, 478); |
| | | Size = new Size(640, 480); |
| | | ResumeLayout(false); |
| | | } |
| | | |
| | |
| | | |
| | | Name = "AllProcessesPage"; |
| | | Text = "主çé¢"; |
| | | //this.Font = new Font("Microsoft YaHei UI", 16F, FontStyle.Regular, GraphicsUnit.Point, 0); |
| | | this.BackColor = Color.FromArgb(32, 41, 50); |
| | | |
| | | InitVisionUI(); |
| | |
| | | |
| | | public void InitVisionUI() |
| | | { |
| | | this.controlsPanel.Dock = DockStyle.Fill; |
| | | List<string> keys = dicProcessControls.Keys.ToList(); |
| | | |
| | | foreach (var title in keys) |
| | |
| | | foreach (var layout in GlobalVar.dicLayout.Values) |
| | | { |
| | | if (GlobalVar.dicProcesses.ContainsKey(layout.ProcessName)) |
| | | { |
| | | enableLayout++; |
| | | } |
| | | } |
| | | |
| | | int index = 0; |
| | |
| | | ProcessControl processControl = dicProcessControls[title]; |
| | | processControl.Size |
| | | = new Size(this.controlsPanel.Size.Width / enableLayout |
| | | , this.controlsPanel.Size.Height); |
| | | , this.controlsPanel.Size.Height-40); |
| | | processControl.Location |
| | | = new Point(processControl.Size.Width * index, 0); |
| | | |
| | | if (GlobalVar.dicProcesses[name].GetImage(GlobalVar.dicLayout[i], out _, out HObject RecordImage)) |
| | | { |
| | | dicProcessControls[title].ShowHoImage(RecordImage); |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | this.controlsPanel.Controls.Add(processControl); |
| | | |
| | | if (GlobalVar.dicProcesses[name].GetImage(GlobalVar.dicLayout[i], out _, out HObject RecordImage)) |
| | | { |
| | | dicProcessControls[title].ShowHoImage(RecordImage); |
| | | } |
| | | } |
| | | index++; |
| | | } |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <root> |
| | | <!-- |
| | | Microsoft ResX Schema |
| | | Microsoft ResX Schema |
| | | |
| | | Version 2.0 |
| | | |
| | |
| | | value : The object must be serialized with |
| | | : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter |
| | | : and then encoded with base64 encoding. |
| | | |
| | | |
| | | mimetype: application/x-microsoft.net.object.soap.base64 |
| | | value : The object must be serialized with |
| | | : System.Runtime.Serialization.Formatters.Soap.SoapFormatter |
| | |
| | | <resheader name="writer"> |
| | | <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
| | | </resheader> |
| | | <metadata name="controlsPanel.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> |
| | | <value>33, 33</value> |
| | | </metadata> |
| | | <metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> |
| | | <value>False</value> |
| | | </metadata> |
| | | </root> |
| | |
| | | /// </summary> |
| | | private void InitializeComponent() |
| | | { |
| | | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ProcessControl)); |
| | | toolStrip1 = new ToolStrip(); |
| | | lblTitle = new ToolStripLabel(); |
| | | btnRun = new ToolStripButton(); |
| | |
| | | tableLayoutPanel1 = new TableLayoutPanel(); |
| | | tableLayoutPanel2 = new TableLayoutPanel(); |
| | | label1 = new Label(); |
| | | uiPanel1 = new Sunny.UI.UIPanel(); |
| | | toolStrip1.SuspendLayout(); |
| | | tableLayoutPanel1.SuspendLayout(); |
| | | tableLayoutPanel2.SuspendLayout(); |
| | | uiPanel1.SuspendLayout(); |
| | | SuspendLayout(); |
| | | // |
| | | // toolStrip1 |
| | | // |
| | | toolStrip1.BackColor = Color.FromArgb(32, 41, 50); |
| | | toolStrip1.ImageScalingSize = new Size(20, 20); |
| | | toolStrip1.Items.AddRange(new ToolStripItem[] { lblTitle, btnRun, btnCircleRun }); |
| | | toolStrip1.Location = new Point(0, 0); |
| | | toolStrip1.Name = "toolStrip1"; |
| | | toolStrip1.Size = new Size(360, 25); |
| | | toolStrip1.Size = new Size(450, 27); |
| | | toolStrip1.TabIndex = 0; |
| | | toolStrip1.Text = "toolStrip1"; |
| | | // |
| | | // lblTitle |
| | | // |
| | | lblTitle.BackColor = SystemColors.ActiveCaptionText; |
| | | lblTitle.ForeColor = SystemColors.ControlText; |
| | | lblTitle.Name = "lblTitle"; |
| | | lblTitle.Size = new Size(56, 22); |
| | | lblTitle.Size = new Size(69, 24); |
| | | lblTitle.Text = "æµç¨åç§°"; |
| | | // |
| | | // btnRun |
| | | // |
| | | btnRun.ForeColor = SystemColors.ControlText; |
| | | btnRun.Image = (Image)resources.GetObject("btnRun.Image"); |
| | | btnRun.ImageTransparentColor = Color.Magenta; |
| | | btnRun.Name = "btnRun"; |
| | | btnRun.Size = new Size(60, 22); |
| | | btnRun.Size = new Size(93, 24); |
| | | btnRun.Text = "忬¡è¿è¡"; |
| | | btnRun.ToolTipText = "忬¡è¿è¡"; |
| | | btnRun.Click += btnRun_Click; |
| | | // |
| | | // btnCircleRun |
| | | // |
| | | btnCircleRun.ForeColor = SystemColors.ControlText; |
| | | btnCircleRun.Image = (Image)resources.GetObject("btnCircleRun.Image"); |
| | | btnCircleRun.ImageTransparentColor = Color.Magenta; |
| | | btnCircleRun.Name = "btnCircleRun"; |
| | | btnCircleRun.Size = new Size(60, 22); |
| | | btnCircleRun.Size = new Size(93, 24); |
| | | btnCircleRun.Text = "è¿ç»è¿è¡"; |
| | | btnCircleRun.ToolTipText = "è¿ç»"; |
| | | btnCircleRun.Click += btnCircleRun_Click; |
| | | // |
| | | // panel1 |
| | | // |
| | | panel1.BackColor = Color.FromArgb(32, 41, 50); |
| | | panel1.Dock = DockStyle.Fill; |
| | | panel1.Location = new Point(3, 3); |
| | | panel1.Name = "panel1"; |
| | | panel1.Size = new Size(354, 187); |
| | | panel1.Size = new Size(444, 224); |
| | | panel1.TabIndex = 1; |
| | | // |
| | | // tableLayoutPanel1 |
| | | // |
| | | tableLayoutPanel1.BackColor = Color.FromArgb(32, 41, 50); |
| | | tableLayoutPanel1.ColumnCount = 1; |
| | | tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F)); |
| | | tableLayoutPanel1.Controls.Add(panel1, 0, 0); |
| | | tableLayoutPanel1.Controls.Add(tableLayoutPanel2, 0, 1); |
| | | tableLayoutPanel1.Dock = DockStyle.Fill; |
| | | tableLayoutPanel1.Location = new Point(0, 25); |
| | | tableLayoutPanel1.Location = new Point(0, 0); |
| | | tableLayoutPanel1.Name = "tableLayoutPanel1"; |
| | | tableLayoutPanel1.RowCount = 2; |
| | | tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); |
| | | tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 22F)); |
| | | tableLayoutPanel1.Size = new Size(360, 215); |
| | | tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 30F)); |
| | | tableLayoutPanel1.Size = new Size(450, 260); |
| | | tableLayoutPanel1.TabIndex = 2; |
| | | // |
| | | // tableLayoutPanel2 |
| | | // |
| | | tableLayoutPanel2.BackColor = Color.FromArgb(32, 41, 50); |
| | | tableLayoutPanel2.ColumnCount = 3; |
| | | tableLayoutPanel2.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.3333321F)); |
| | | tableLayoutPanel2.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.3333321F)); |
| | | tableLayoutPanel2.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.3333321F)); |
| | | tableLayoutPanel2.Controls.Add(label1, 0, 0); |
| | | tableLayoutPanel2.Dock = DockStyle.Fill; |
| | | tableLayoutPanel2.Location = new Point(3, 196); |
| | | tableLayoutPanel2.Location = new Point(3, 233); |
| | | tableLayoutPanel2.Name = "tableLayoutPanel2"; |
| | | tableLayoutPanel2.RowCount = 1; |
| | | tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); |
| | | tableLayoutPanel2.Size = new Size(354, 16); |
| | | tableLayoutPanel2.Size = new Size(444, 24); |
| | | tableLayoutPanel2.TabIndex = 2; |
| | | // |
| | | // label1 |
| | | // |
| | | label1.AutoSize = true; |
| | | label1.BackColor = Color.FromArgb(32, 41, 50); |
| | | label1.Dock = DockStyle.Fill; |
| | | label1.ForeColor = SystemColors.Control; |
| | | label1.Location = new Point(3, 0); |
| | | label1.Name = "label1"; |
| | | label1.Size = new Size(112, 16); |
| | | label1.Size = new Size(141, 24); |
| | | label1.TabIndex = 0; |
| | | label1.Text = "æ»æ°ï¼0"; |
| | | label1.DoubleClick += lblCount_DoubleClick; |
| | | label1.MouseHover += lblCount_MouseHover; |
| | | // |
| | | // uiPanel1 |
| | | // |
| | | uiPanel1.Controls.Add(tableLayoutPanel1); |
| | | uiPanel1.Dock = DockStyle.Fill; |
| | | uiPanel1.Font = new Font("å®ä½", 12F, FontStyle.Regular, GraphicsUnit.Point, 134); |
| | | uiPanel1.Location = new Point(0, 27); |
| | | uiPanel1.Margin = new Padding(5, 6, 5, 6); |
| | | uiPanel1.MinimumSize = new Size(1, 1); |
| | | uiPanel1.Name = "uiPanel1"; |
| | | uiPanel1.Size = new Size(450, 260); |
| | | uiPanel1.TabIndex = 3; |
| | | uiPanel1.Text = "uiPanel1"; |
| | | uiPanel1.TextAlignment = ContentAlignment.MiddleCenter; |
| | | // |
| | | // ProcessControl |
| | | // |
| | | AutoScaleDimensions = new SizeF(96F, 96F); |
| | | AutoScaleDimensions = new SizeF(120F, 120F); |
| | | AutoScaleMode = AutoScaleMode.Dpi; |
| | | BackColor = SystemColors.Control; |
| | | Controls.Add(tableLayoutPanel1); |
| | | BackColor = Color.FromArgb(32, 41, 50); |
| | | Controls.Add(uiPanel1); |
| | | Controls.Add(toolStrip1); |
| | | ForeColor = SystemColors.Control; |
| | | Margin = new Padding(4, 4, 4, 4); |
| | | Name = "ProcessControl"; |
| | | Size = new Size(360, 240); |
| | | Size = new Size(450, 287); |
| | | Load += ProcessControl_Load; |
| | | toolStrip1.ResumeLayout(false); |
| | | toolStrip1.PerformLayout(); |
| | | tableLayoutPanel1.ResumeLayout(false); |
| | | tableLayoutPanel2.ResumeLayout(false); |
| | | tableLayoutPanel2.PerformLayout(); |
| | | uiPanel1.ResumeLayout(false); |
| | | ResumeLayout(false); |
| | | PerformLayout(); |
| | | } |
| | |
| | | private TableLayoutPanel tableLayoutPanel2; |
| | | private Label label1; |
| | | private ToolStripButton btnCircleRun; |
| | | private Sunny.UI.UIPanel uiPanel1; |
| | | } |
| | | } |
| | |
| | | using HalconDotNet; |
| | | using LB_SmartVision.Forms.Pages.SettingPage; |
| | | using LB_SmartVision.ProcessRun; |
| | | using LB_VisionControl; |
| | | using Layout = LB_SmartVision.Forms.Pages.SettingPage.Layout; |
| | | |
| | | |
| | | namespace LB_SmartVision.Forms.Pages.ProcessPage |
| | | { |
| | |
| | | })); |
| | | } |
| | | else |
| | | { |
| | | UserHSmartWindowControl.ClearObj(); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | })); |
| | | } |
| | | else |
| | | { |
| | | this.label1.Text = $"æ»æ°ï¼{ProcessRunBll.total}"; |
| | | } |
| | | } |
| | | |
| | | public bool Run(out string msg) |
| | |
| | | } |
| | | |
| | | if (isCircleRuning || ProcessRunBll.bRuning) |
| | | { |
| | | ProcessRunBll.LogInfo($"{ProcessRunBll.Name}æ£å¨è¿è¡", LogInfoType.ERROR); |
| | | } |
| | | |
| | | ProcessRunBll.Run(); |
| | | |
| | |
| | | try |
| | | { |
| | | if (ProcessRunBll == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | ProcessRunBll.LogInfo(string.Format("æµç¨[{0}]å¼å§è¿è¡", this.ProcessRunBll.Name), LogInfoType.INFO); |
| | | |
| | |
| | | result = Run(out msg); |
| | | |
| | | if (ProcessRunBll.GetImage(_Layout, out _, out HObject RecordImage)) |
| | | { |
| | | ShowHoImage(RecordImage); |
| | | } |
| | | } |
| | | catch { msg = "è¿è¡åºç°äºå¼å¸¸"; } |
| | | |
| | |
| | | else |
| | | { |
| | | isCircleRuning = false; |
| | | threadCircleRun.Abort(); |
| | | //threadCircleRun.Abort(); |
| | | } |
| | | } |
| | | catch { } |
| | |
| | | , result ? LogInfoType.PASS : LogInfoType.ERROR); |
| | | |
| | | if (ProcessRunBll.GetImage(_Layout, out _, out HObject RecordImage)) |
| | | { |
| | | ShowHoImage(RecordImage); |
| | | } |
| | | } |
| | | catch { } |
| | | //})); |
| | | |
| | | Thread.Sleep(100); |
| | | Thread.Sleep(33); |
| | | } |
| | | } |
| | | |
| | |
| | | <metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> |
| | | <value>17, 17</value> |
| | | </metadata> |
| | | <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> |
| | | <data name="btnRun.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
| | | <value> |
| | | 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 |
| | | 4Nmz/wFiFwy8eFJuyQAAAABJRU5ErkJggg== |
| | | </value> |
| | | </data> |
| | | <data name="btnCircleRun.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
| | | <value> |
| | | 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 |
| | | gg== |
| | | </value> |
| | | </data> |
| | | </root> |
| | |
| | | <Reference Include="halcondotnet"> |
| | | <HintPath>ref\halcondotnet.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="MySql.Data"> |
| | | <HintPath>ref\MySql.Data.dll</HintPath> |
| | | </Reference> |
| | | </ItemGroup> |
| | | |
| | | <ItemGroup> |
| | | <None Update="log4net.config"> |
| | | <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
| | | </None> |
| | | <None Update="ref\halcondotnet.dll"> |
| | | <CopyToOutputDirectory>Always</CopyToOutputDirectory> |
| | | </None> |
| | | <None Update="ref\MySql.Data.dll"> |
| | | <CopyToOutputDirectory>Always</CopyToOutputDirectory> |
| | | </None> |
| | | </ItemGroup> |
| | | |
| | | </Project> |
| | |
| | | return res; |
| | | } |
| | | |
| | | public bool GetImage(Layout layout, out HObject InputImage, out HObject RecordImage) |
| | | public bool GetImage(Layout layout, out HImage InputImage, out HObject RecordImage) |
| | | { |
| | | InputImage = null; RecordImage = null; |
| | | try |
| | |
| | | IndexValueName = arrOutputs[2]; |
| | | |
| | | object o_InputImage = ((IProcess)dicContext[IndexProcessName]).OutputImage; |
| | | if (o_InputImage is HObject ho_image && ho_image.IsInitialized()) |
| | | InputImage = ho_image; |
| | | else if (o_InputImage is Bitmap) |
| | | if (o_InputImage != null && o_InputImage is HImage ho_image && ho_image.IsInitialized()) |
| | | { |
| | | //å°Mat转æ¢ä¸ºHObject |
| | | TAlgorithm.Bitmap2HObject((Bitmap)o_InputImage, out HObject ho_RecordImage); |
| | | InputImage = ho_RecordImage; |
| | | InputImage = ho_image.Clone(); |
| | | ho_image.Dispose(); |
| | | } |
| | | else if (o_InputImage is Mat) |
| | | else if (o_InputImage != null && o_InputImage is Bitmap) |
| | | { |
| | | //å°Mat转æ¢ä¸ºHObject |
| | | TAlgorithm.Mat2HObject((Mat)o_InputImage, out HObject ho_RecordImage); |
| | | InputImage = ho_RecordImage; |
| | | using (HImage ho_RecordImage = TAlgorithm.Bitmap2HObject((Bitmap)o_InputImage)) |
| | | { |
| | | if (ho_RecordImage != null) |
| | | { |
| | | InputImage = ho_RecordImage.Clone(); |
| | | } |
| | | } |
| | | } |
| | | else if (o_InputImage != null && o_InputImage is Mat) |
| | | { |
| | | //å°Mat转æ¢ä¸ºHObject |
| | | using (HImage ho_RecordImage = TAlgorithm.Mat2HObject((Mat)o_InputImage)) |
| | | { |
| | | if (ho_RecordImage != null) |
| | | { |
| | | InputImage = ho_RecordImage.Clone(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (InputImage != null && InputImage.IsInitialized()) |
| | | { |
| | | HOperatorSet.GetImageSize(InputImage, out ho_ImageWidth, out ho_ImageHeight); |
| | | InputImage.GetImageSize(out ho_ImageWidth, out ho_ImageHeight); |
| | | |
| | | //å¾ç尺寸ååææ´æ°çªå£å°ºå¯¸[æé«é度] |
| | | if ((ho_ImageWidth.Length > 0 && ho_ImageWidth.TupleInt() != hWindowControl.Size.Width) |
| | |
| | | if (dicContext.TryGetValue(ProcessName, out IProcess obj) |
| | | && obj is IProcess process) |
| | | { |
| | | 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; |
| | | } |
| | | UpdateInputs(process); |
| | | |
| | | // ä¸åèç¹è·³è¿çæ¹å¼ä¸å |
| | |
| | | /// </summary> |
| | | public double RunTime = 0; |
| | | |
| | | public bool GetImage(Forms.Pages.SettingPage.Layout layout, out HObject InputImage, out HObject RecordImage) |
| | | public bool GetImage(Forms.Pages.SettingPage.Layout layout, out HImage InputImage, out HObject RecordImage) |
| | | { |
| | | return ProcessContext.GetImage(layout, out InputImage, out RecordImage); |
| | | } |
| | | |
| | | public bool GetImage(out HObject InputImage, out HObject RecordImage) |
| | | public bool GetImage(out HImage InputImage, out HObject RecordImage) |
| | | { |
| | | InputImage = null; |
| | | RecordImage = null; |
| | |
| | | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(VisionForm)); |
| | | theme_VisionForm = new ReaLTaiizor.Forms.ThemeForm(); |
| | | sc_VisionForm = new SplitContainer(); |
| | | sc_VisionMainViewer = new SplitContainer(); |
| | | tlp_VisionMainForm = new Sunny.UI.UITableLayoutPanel(); |
| | | tlp_MainView = new Sunny.UI.UITableLayoutPanel(); |
| | | 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(); |
| | | materialTabSelector = new MaterialSkin.Controls.MaterialTabSelector(); |
| | | materialTabControl = new MaterialSkin.Controls.MaterialTabControl(); |
| | | tabPage1 = new TabPage(); |
| | | tabPage2 = new TabPage(); |
| | | grb_Info = new Sunny.UI.UIGroupBox(); |
| | | rich_Info = new Sunny.UI.UIRichTextBox(); |
| | | cb_VisionForm = new ReaLTaiizor.Controls.ControlBox(); |
| | |
| | | sc_VisionForm.Panel1.SuspendLayout(); |
| | | sc_VisionForm.Panel2.SuspendLayout(); |
| | | sc_VisionForm.SuspendLayout(); |
| | | ((System.ComponentModel.ISupportInitialize)sc_VisionMainViewer).BeginInit(); |
| | | sc_VisionMainViewer.Panel1.SuspendLayout(); |
| | | sc_VisionMainViewer.Panel2.SuspendLayout(); |
| | | sc_VisionMainViewer.SuspendLayout(); |
| | | tlp_VisionMainForm.SuspendLayout(); |
| | | tlp_MainView.SuspendLayout(); |
| | | tlp_VisionMainOperator.SuspendLayout(); |
| | | materialTabControl.SuspendLayout(); |
| | | grb_Info.SuspendLayout(); |
| | | SuspendLayout(); |
| | | // |
| | |
| | | theme_VisionForm.Padding = new Padding(10, 70, 10, 9); |
| | | theme_VisionForm.RoundCorners = true; |
| | | theme_VisionForm.Sizable = true; |
| | | theme_VisionForm.Size = new Size(1440, 960); |
| | | theme_VisionForm.Size = new Size(1440, 880); |
| | | theme_VisionForm.SmartBounds = true; |
| | | theme_VisionForm.StartPosition = FormStartPosition.WindowsDefaultLocation; |
| | | theme_VisionForm.TabIndex = 0; |
| | |
| | | // sc_VisionForm |
| | | // |
| | | sc_VisionForm.Dock = DockStyle.Fill; |
| | | sc_VisionForm.FixedPanel = FixedPanel.Panel2; |
| | | sc_VisionForm.Location = new Point(10, 70); |
| | | sc_VisionForm.Name = "sc_VisionForm"; |
| | | sc_VisionForm.Orientation = Orientation.Horizontal; |
| | | // |
| | | // sc_VisionForm.Panel1 |
| | | // |
| | | sc_VisionForm.Panel1.Controls.Add(sc_VisionMainViewer); |
| | | sc_VisionForm.Panel1.Controls.Add(tlp_MainView); |
| | | // |
| | | // sc_VisionForm.Panel2 |
| | | // |
| | | sc_VisionForm.Panel2.Controls.Add(grb_Info); |
| | | sc_VisionForm.Size = new Size(1420, 881); |
| | | sc_VisionForm.SplitterDistance = 699; |
| | | sc_VisionForm.Size = new Size(1420, 801); |
| | | sc_VisionForm.SplitterDistance = 618; |
| | | sc_VisionForm.TabIndex = 1; |
| | | // |
| | | // sc_VisionMainViewer |
| | | // tlp_MainView |
| | | // |
| | | sc_VisionMainViewer.Dock = DockStyle.Fill; |
| | | sc_VisionMainViewer.Location = new Point(0, 0); |
| | | sc_VisionMainViewer.Name = "sc_VisionMainViewer"; |
| | | sc_VisionMainViewer.Orientation = Orientation.Horizontal; |
| | | tlp_MainView.ColumnCount = 1; |
| | | tlp_MainView.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F)); |
| | | tlp_MainView.Controls.Add(materialTabControl, 0, 2); |
| | | tlp_MainView.Controls.Add(tlp_VisionMainOperator, 0, 1); |
| | | tlp_MainView.Controls.Add(materialTabSelector, 0, 0); |
| | | tlp_MainView.Dock = DockStyle.Fill; |
| | | tlp_MainView.Location = new Point(0, 0); |
| | | tlp_MainView.Name = "tlp_MainView"; |
| | | tlp_MainView.RowCount = 3; |
| | | 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(1420, 618); |
| | | tlp_MainView.TabIndex = 1; |
| | | tlp_MainView.TagString = null; |
| | | // |
| | | // sc_VisionMainViewer.Panel1 |
| | | // materialTabControl |
| | | // |
| | | sc_VisionMainViewer.Panel1.Controls.Add(tlp_VisionMainForm); |
| | | // |
| | | // sc_VisionMainViewer.Panel2 |
| | | // |
| | | sc_VisionMainViewer.Panel2.Controls.Add(materialTabControl); |
| | | sc_VisionMainViewer.Size = new Size(1420, 699); |
| | | sc_VisionMainViewer.SplitterDistance = 100; |
| | | sc_VisionMainViewer.TabIndex = 0; |
| | | // |
| | | // tlp_VisionMainForm |
| | | // |
| | | tlp_VisionMainForm.BackColor = Color.FromArgb(39, 51, 63); |
| | | tlp_VisionMainForm.ColumnCount = 1; |
| | | tlp_VisionMainForm.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F)); |
| | | tlp_VisionMainForm.Controls.Add(tlp_VisionMainOperator, 0, 1); |
| | | tlp_VisionMainForm.Controls.Add(materialTabSelector, 0, 0); |
| | | tlp_VisionMainForm.Dock = DockStyle.Fill; |
| | | tlp_VisionMainForm.Location = new Point(0, 0); |
| | | tlp_VisionMainForm.Name = "tlp_VisionMainForm"; |
| | | tlp_VisionMainForm.RowCount = 2; |
| | | tlp_VisionMainForm.RowStyles.Add(new RowStyle(SizeType.Absolute, 61F)); |
| | | tlp_VisionMainForm.RowStyles.Add(new RowStyle(SizeType.Absolute, 39F)); |
| | | tlp_VisionMainForm.Size = new Size(1420, 100); |
| | | tlp_VisionMainForm.TabIndex = 0; |
| | | tlp_VisionMainForm.TagString = null; |
| | | materialTabControl.AccessibleRole = AccessibleRole.Sound; |
| | | materialTabControl.Depth = 0; |
| | | materialTabControl.Dock = DockStyle.Fill; |
| | | materialTabControl.Location = new Point(3, 102); |
| | | materialTabControl.MouseState = MaterialSkin.MouseState.HOVER; |
| | | materialTabControl.Name = "materialTabControl"; |
| | | materialTabControl.SelectedIndex = 0; |
| | | materialTabControl.Size = new Size(1414, 513); |
| | | materialTabControl.TabIndex = 0; |
| | | // |
| | | // tlp_VisionMainOperator |
| | | // |
| | |
| | | tlp_VisionMainOperator.Controls.Add(btn_GlobalVar, 7, 0); |
| | | tlp_VisionMainOperator.Controls.Add(com_ProductName, 8, 0); |
| | | tlp_VisionMainOperator.Dock = DockStyle.Fill; |
| | | tlp_VisionMainOperator.Location = new Point(3, 64); |
| | | tlp_VisionMainOperator.Location = new Point(3, 63); |
| | | tlp_VisionMainOperator.Name = "tlp_VisionMainOperator"; |
| | | tlp_VisionMainOperator.RowCount = 1; |
| | | tlp_VisionMainOperator.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); |
| | |
| | | // |
| | | // materialTabSelector |
| | | // |
| | | materialTabSelector.BaseTabControl = materialTabControl; |
| | | materialTabSelector.BaseTabControl = null; |
| | | materialTabSelector.Depth = 0; |
| | | materialTabSelector.Dock = DockStyle.Fill; |
| | | materialTabSelector.Location = new Point(3, 3); |
| | | materialTabSelector.MouseState = MaterialSkin.MouseState.HOVER; |
| | | materialTabSelector.Name = "materialTabSelector"; |
| | | materialTabSelector.Size = new Size(1414, 55); |
| | | materialTabSelector.Size = new Size(1414, 54); |
| | | materialTabSelector.TabIndex = 1; |
| | | // |
| | | // materialTabControl |
| | | // |
| | | materialTabControl.AccessibleRole = AccessibleRole.Sound; |
| | | materialTabControl.Controls.Add(tabPage1); |
| | | materialTabControl.Controls.Add(tabPage2); |
| | | materialTabControl.Depth = 0; |
| | | materialTabControl.Dock = DockStyle.Fill; |
| | | materialTabControl.Location = new Point(0, 0); |
| | | materialTabControl.MouseState = MaterialSkin.MouseState.HOVER; |
| | | materialTabControl.Name = "materialTabControl"; |
| | | materialTabControl.SelectedIndex = 0; |
| | | materialTabControl.Size = new Size(1420, 595); |
| | | materialTabControl.TabIndex = 0; |
| | | // |
| | | // tabPage1 |
| | | // |
| | | tabPage1.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134); |
| | | tabPage1.Location = new Point(4, 30); |
| | | tabPage1.Name = "tabPage1"; |
| | | tabPage1.Size = new Size(1412, 561); |
| | | tabPage1.TabIndex = 0; |
| | | tabPage1.Text = "tabPage1"; |
| | | tabPage1.UseVisualStyleBackColor = true; |
| | | // |
| | | // tabPage2 |
| | | // |
| | | tabPage2.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134); |
| | | tabPage2.Location = new Point(4, 26); |
| | | tabPage2.Name = "tabPage2"; |
| | | tabPage2.Size = new Size(1412, 565); |
| | | tabPage2.TabIndex = 1; |
| | | tabPage2.Text = "tabPage2"; |
| | | tabPage2.UseVisualStyleBackColor = true; |
| | | // |
| | | // grb_Info |
| | | // |
| | |
| | | grb_Info.MinimumSize = new Size(1, 1); |
| | | grb_Info.Name = "grb_Info"; |
| | | grb_Info.Padding = new Padding(0, 32, 0, 0); |
| | | grb_Info.Size = new Size(1420, 178); |
| | | grb_Info.Size = new Size(1420, 179); |
| | | grb_Info.TabIndex = 1; |
| | | grb_Info.Text = "æ¥å¿æ¾ç¤ºåºï¼"; |
| | | grb_Info.TextAlignment = ContentAlignment.MiddleLeft; |
| | |
| | | rich_Info.Name = "rich_Info"; |
| | | rich_Info.Padding = new Padding(2); |
| | | rich_Info.ShowText = false; |
| | | rich_Info.Size = new Size(1420, 146); |
| | | rich_Info.Size = new Size(1420, 147); |
| | | rich_Info.TabIndex = 0; |
| | | rich_Info.TextAlignment = ContentAlignment.MiddleLeft; |
| | | // |
| | |
| | | cb_VisionForm.EnableMaximizeButton = true; |
| | | cb_VisionForm.EnableMinimizeButton = true; |
| | | cb_VisionForm.ForeColor = Color.FromArgb(155, 155, 155); |
| | | cb_VisionForm.Location = new Point(1340, 18); |
| | | cb_VisionForm.Location = new Point(1360, 14); |
| | | cb_VisionForm.MaximizeHoverColor = Color.FromArgb(74, 74, 74); |
| | | cb_VisionForm.MinimizeHoverColor = Color.FromArgb(63, 63, 65); |
| | | cb_VisionForm.Name = "cb_VisionForm"; |
| | |
| | | // |
| | | AutoScaleDimensions = new SizeF(96F, 96F); |
| | | AutoScaleMode = AutoScaleMode.Dpi; |
| | | ClientSize = new Size(1440, 960); |
| | | ClientSize = new Size(1440, 880); |
| | | Controls.Add(theme_VisionForm); |
| | | FormBorderStyle = FormBorderStyle.None; |
| | | Icon = (Icon)resources.GetObject("$this.Icon"); |
| | |
| | | sc_VisionForm.Panel2.ResumeLayout(false); |
| | | ((System.ComponentModel.ISupportInitialize)sc_VisionForm).EndInit(); |
| | | sc_VisionForm.ResumeLayout(false); |
| | | sc_VisionMainViewer.Panel1.ResumeLayout(false); |
| | | sc_VisionMainViewer.Panel2.ResumeLayout(false); |
| | | ((System.ComponentModel.ISupportInitialize)sc_VisionMainViewer).EndInit(); |
| | | sc_VisionMainViewer.ResumeLayout(false); |
| | | tlp_VisionMainForm.ResumeLayout(false); |
| | | tlp_MainView.ResumeLayout(false); |
| | | tlp_VisionMainOperator.ResumeLayout(false); |
| | | materialTabControl.ResumeLayout(false); |
| | | grb_Info.ResumeLayout(false); |
| | | ResumeLayout(false); |
| | | } |
| | |
| | | private ReaLTaiizor.Forms.ThemeForm theme_VisionForm; |
| | | private ReaLTaiizor.Controls.ControlBox cb_VisionForm; |
| | | private SplitContainer sc_VisionForm; |
| | | private SplitContainer sc_VisionMainViewer; |
| | | 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.UITableLayoutPanel tlp_VisionMainForm; |
| | | 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 TabPage tabPage1; |
| | | private TabPage tabPage2; |
| | | private Sunny.UI.UITableLayoutPanel tlp_MainView; |
| | | } |
| | | } |
| | |
| | | { |
| | | public partial class VisionForm : Form |
| | | { |
| | | AllProcessesPage AllProcessesPage = new AllProcessesPage(); |
| | | AllProcessesPage AllProcessesPages = new AllProcessesPage(); |
| | | CamerasEditPage CamerasEditPage = new CamerasEditPage(); |
| | | CommunicatorsEditPage CommunicatorsEditPage = new CommunicatorsEditPage(); |
| | | SettingEditPage SettingEditPage = new SettingEditPage(); |
| | |
| | | |
| | | //æå¼å§å°±æ¸
空ææTab页 |
| | | materialTabControl.TabPages.Clear(); |
| | | materialTabControl.Controls.Add(AllProcessesPage); |
| | | AllProcessesPages.controlsPanel.Dock = DockStyle.Fill; |
| | | materialTabControl.Controls.Add(AllProcessesPages); |
| | | |
| | | |
| | | CamerasEditPage.LogInfo += LogInfo; |
| | | materialTabControl.Controls.Add(new MyPage(CamerasEditPage)); |
| | |
| | | { |
| | | //materialTabControl.TabPages[i].Font= new Font("Microsoft YaHei UI", 18F, FontStyle.Regular, GraphicsUnit.Point, 0); |
| | | } |
| | | |
| | | materialTabSelector.BaseTabControl = materialTabControl; |
| | | //materialTabSelector.Font = new Font("Microsoft YaHei UI", 18F, FontStyle.Regular, GraphicsUnit.Point, 0); |
| | | } |
| | |
| | | { |
| | | return; |
| | | } |
| | | string strInfo = DateTime.Now.ToString("[yyyy:MM:HH:mm:ss:fff] "); |
| | | string strInfo = DateTime.Now.ToString("[yyyy:MM:dd:HH:mm:ss:fff] "); |
| | | strInfo += strLog; |
| | | if (infoType != LogInfoType.NOSHOW) |
| | | { |
| | |
| | | switch (infoType) |
| | | { |
| | | case LogInfoType.INFO: |
| | | this.rich_Info.SelectionColor = Color.Wheat; |
| | | break; |
| | | { |
| | | this.rich_Info.SelectionColor = Color.Wheat; |
| | | AsyncLogHelper.Info(strLog); |
| | | break; |
| | | } |
| | | case LogInfoType.WARN: |
| | | this.rich_Info.SelectionColor = Color.LightGoldenrodYellow; |
| | | break; |
| | | { |
| | | this.rich_Info.SelectionColor = Color.Yellow; |
| | | AsyncLogHelper.Warn(strLog); |
| | | break; |
| | | } |
| | | case LogInfoType.PASS: |
| | | this.rich_Info.SelectionColor = Color.Green; |
| | | break; |
| | | { |
| | | this.rich_Info.SelectionColor = Color.Green; |
| | | AsyncLogHelper.Info(strLog); |
| | | break; |
| | | } |
| | | case LogInfoType.ERROR: |
| | | this.rich_Info.SelectionColor = Color.Red; |
| | | break; |
| | | { |
| | | this.rich_Info.SelectionColor = Color.Red; |
| | | AsyncLogHelper.Error(strLog); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | // æ´æ° UI æ§ä»¶ï¼æ¯å¦æ¾ç¤ºæ¥æ¶å°çæ¶æ¯ |
| | | this.rich_Info.AppendText(strInfo); |
| | | this.rich_Info.AppendText("\r\n"); |
| | |
| | | { |
| | | |
| | | if (this.rich_Info.Lines.Length > 1000) |
| | | { |
| | | this.rich_Info.Clear(); |
| | | |
| | | } |
| | | // 妿已ç»å¨ UI 线ç¨ä¸ï¼ç´æ¥æ´æ° UI |
| | | switch (infoType) |
| | | { |
| | | case LogInfoType.INFO: |
| | | this.rich_Info.SelectionColor = Color.Wheat; |
| | | break; |
| | | { |
| | | this.rich_Info.SelectionColor = Color.Wheat; |
| | | AsyncLogHelper.Info(strLog); |
| | | break; |
| | | } |
| | | case LogInfoType.WARN: |
| | | this.rich_Info.SelectionColor = Color.Yellow; |
| | | break; |
| | | { |
| | | this.rich_Info.SelectionColor = Color.Yellow; |
| | | AsyncLogHelper.Warn(strLog); |
| | | break; |
| | | } |
| | | case LogInfoType.PASS: |
| | | this.rich_Info.SelectionColor = Color.Green; |
| | | break; |
| | | { |
| | | this.rich_Info.SelectionColor = Color.Green; |
| | | AsyncLogHelper.Info(strLog); |
| | | break; |
| | | } |
| | | case LogInfoType.ERROR: |
| | | this.rich_Info.SelectionColor = Color.Red; |
| | | break; |
| | | { |
| | | this.rich_Info.SelectionColor = Color.Red; |
| | | AsyncLogHelper.Error(strLog); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | this.rich_Info.AppendText(strInfo); |
| | | this.rich_Info.AppendText("\r\n"); |
| | | this.rich_Info.SelectionStart = this.rich_Info.Text.Length; |
| | | this.rich_Info.ScrollToCaret(); |
| | | } |
| | | } |
| | | AsyncLogHelper.Info(strLog); |
| | | } |
| | | |
| | | public static bool SaveAllLayout() |
| | |
| | | { |
| | | XmlConfigurator.Configure(new System.IO.FileInfo("log4net.config")); |
| | | string[] paths = { |
| | | @"ç产æ¥å¿\Run_Log", |
| | | @"ç产æ¥å¿\Debug_Log", |
| | | @"ç产æ¥å¿\Error_Log", |
| | | @"ç产æ¥å¿\Run", |
| | | @"ç产æ¥å¿\Debug", |
| | | @"ç产æ¥å¿\Error", |
| | | @"ç产æ¥å¿\Fatal", |
| | | @"ç产æ¥å¿\Warn", |
| | | }; |
| | |
| | | } |
| | | com_ProductName.Items.Add("æ°å¢"); |
| | | com_ProductName.Text = GlobalVar.strProductName; |
| | | this.WindowState = FormWindowState.Maximized; |
| | | } |
| | | |
| | | public void SaveAllSetting() |
| | |
| | | catch { } |
| | | } |
| | | // çæå¾çå¹¶æ¾ç¤ºå°æ§ä»¶ä¸ |
| | | HObject InputImage = null; |
| | | HImage InputImage = null; |
| | | HObject RecordImage = null; |
| | | |
| | | foreach (var layout in GlobalVar.dicLayout.Values |
| | |
| | | { |
| | | string title = layout.Title; |
| | | string strImagePath = layout.SaveImageDir; |
| | | if (!AllProcessesPage.dicProcessControls.ContainsKey(title)) |
| | | if (!AllProcessesPages.dicProcessControls.ContainsKey(title)) |
| | | { |
| | | continue; |
| | | } |
| | | RunBll.GetImage(layout, out InputImage, out RecordImage); |
| | | AllProcessesPage.dicProcessControls[title].ShowHoImage(RecordImage); |
| | | AllProcessesPages.dicProcessControls[title].ShowHoImage(RecordImage); |
| | | if (!string.IsNullOrEmpty(layout.SaveImageDir)) |
| | | { |
| | | string fileNameHead = layout.SaveImageHead; |
| | |
| | | <?xml version="1.0" encoding="utf-8" ?> |
| | | <configuration> |
| | | <configSections> |
| | | <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> |
| | | </configSections> |
| | | <log4net> |
| | | <root> |
| | | <level value="ALL"/> |
| | | <!-- æ·»å ææappenderå¼ç¨ --> |
| | | <appender-ref ref="DebugLogger" /> |
| | | <appender-ref ref="InfoLogger" /> |
| | | <appender-ref ref="WarnLogger" /> |
| | | <appender-ref ref="ErrorLogger" /> |
| | | <appender-ref ref="FatalLogger" /> |
| | | </root> |
| | | <appender name="DebugLogger" type="log4net.Appender.RollingFileAppender"> |
| | | <file value="ç产æ¥å¿\Debug_Log\"/> |
| | | <appendToFile value="true" /> |
| | | <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> |
| | | <Encoding value="UTF-8" /> |
| | | <maxSizeRollBackups value="-1"/> |
| | | <StaticLogFileName value="false"/> |
| | | <rollingStyle value="Date" /> |
| | | <param name="datePattern" value="yyyy-MM/yyyy-MM-dd.'log'" /> |
| | | <createDirs value="true" /> |
| | | <filter type="log4net.Filter.LevelRangeFilter"> |
| | | <levelMin value="DEBUG" /> |
| | | <levelMax value="DEBUG" /> |
| | | </filter> |
| | | <layout type="log4net.Layout.PatternLayout"> |
| | | <param name="ConversionPattern" value="%date [%thread] %-5level %logger - %message%newline" /> |
| | | </layout> |
| | | </appender> |
| | | <appender name="InfoLogger" type="log4net.Appender.RollingFileAppender"> |
| | | <file value="ç产æ¥å¿\Run_Log\"/> |
| | | <appendToFile value="true" /> |
| | | <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> |
| | | <Encoding value="UTF-8" /> |
| | | <maxSizeRollBackups value="-1"/> |
| | | <StaticLogFileName value="false"/> |
| | | <rollingStyle value="Date" /> |
| | | <param name="datePattern" value="yyyy-MM/yyyy-MM-dd.'log'" /> |
| | | <createDirs value="true" /> |
| | | <filter type="log4net.Filter.LevelRangeFilter"> |
| | | <levelMin value="INFO" /> |
| | | <levelMax value="INFO" /> |
| | | </filter> |
| | | <layout type="log4net.Layout.PatternLayout"> |
| | | <param name="ConversionPattern" value="%date [%thread] %-5level %logger - %message%newline" /> |
| | | </layout> |
| | | </appender> |
| | | <appender name="WarnLogger" type="log4net.Appender.RollingFileAppender"> |
| | | <file value="ç产æ¥å¿\Warn\"/> |
| | | <appendToFile value="true" /> |
| | | <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> |
| | | <Encoding value="UTF-8" /> |
| | | <maxSizeRollBackups value="10"/> |
| | | <StaticLogFileName value="false"/> |
| | | <rollingStyle value="Date" /> |
| | | <param name="datePattern" value="yyyy-MM/yyyy-MM-dd.'log'" /> |
| | | <createDirs value="true" /> |
| | | <filter type="log4net.Filter.LevelRangeFilter"> |
| | | <levelMin value="WARN" /> |
| | | <levelMax value="WARN" /> |
| | | </filter> |
| | | <layout type="log4net.Layout.PatternLayout"> |
| | | <param name="ConversionPattern" value="%date [%thread] %-5level %logger - %message%newline" /> |
| | | </layout> |
| | | </appender> |
| | | <appender name="ErrorLogger" type="log4net.Appender.RollingFileAppender"> |
| | | <file value="ç产æ¥å¿\Error_Log\"/> |
| | | <appendToFile value="true" /> |
| | | <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> |
| | | <Encoding value="UTF-8" /> |
| | | <maxSizeRollBackups value="-1"/> |
| | | <StaticLogFileName value="false"/> |
| | | <rollingStyle value="Date" /> |
| | | <param name="datePattern" value="yyyy-MM/yyyy-MM-dd.'log'" /> |
| | | <createDirs value="true" /> |
| | | <filter type="log4net.Filter.LevelRangeFilter"> |
| | | <levelMin value="ERROR" /> |
| | | <levelMax value="ERROR" /> |
| | | </filter> |
| | | <layout type="log4net.Layout.PatternLayout"> |
| | | <param name="ConversionPattern" value="%date [%thread] %-5level %logger - %message%newline" /> |
| | | </layout> |
| | | </appender> |
| | | <appender name="FatalLogger" type="log4net.Appender.RollingFileAppender"> |
| | | <file value="ç产æ¥å¿\Fatal\"/> |
| | | <appendToFile value="true" /> |
| | | <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> |
| | | <Encoding value="UTF-8" /> |
| | | <maxSizeRollBackups value="-1"/> |
| | | <StaticLogFileName value="false"/> |
| | | <rollingStyle value="Date" /> |
| | | <param name="datePattern" value="yyyy-MM/yyyy-MM-dd.'log'" /> |
| | | <createDirs value="true" /> |
| | | <filter type="log4net.Filter.LevelRangeFilter"> |
| | | <levelMin value="FATAL" /> |
| | | <levelMax value="FATAL" /> |
| | | </filter> |
| | | <layout type="log4net.Layout.PatternLayout"> |
| | | <param name="ConversionPattern" value="%date [%thread] %-5level %logger - %message%newline" /> |
| | | </layout> |
| | | </appender> |
| | | </log4net> |
| | | <configSections> |
| | | <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> |
| | | </configSections> |
| | | <log4net> |
| | | <root> |
| | | <level value="ALL"/> |
| | | <!-- æ·»å ææappenderå¼ç¨ --> |
| | | <appender-ref ref="DebugLogger" /> |
| | | <appender-ref ref="InfoLogger" /> |
| | | <appender-ref ref="WarnLogger" /> |
| | | <appender-ref ref="ErrorLogger" /> |
| | | <appender-ref ref="FatalLogger" /> |
| | | </root> |
| | | <appender name="DebugLogger" type="log4net.Appender.RollingFileAppender"> |
| | | <file value="ç产æ¥å¿\Debug\"/> |
| | | <appendToFile value="true" /> |
| | | <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> |
| | | <Encoding value="UTF-8" /> |
| | | <rollingStyle value="Composite" /> |
| | | <datePattern value="yyyy-MM/yyyy-MM-dd.'log'" /> |
| | | <maximumFileSize value="10MB" /> |
| | | <maxSizeRollBackups value="-1" /> |
| | | <StaticLogFileName value="true" /> |
| | | <createDirs value="true" /> |
| | | <filter type="log4net.Filter.LevelRangeFilter"> |
| | | <levelMin value="DEBUG" /> |
| | | <levelMax value="DEBUG" /> |
| | | </filter> |
| | | <layout type="log4net.Layout.PatternLayout"> |
| | | <param name="ConversionPattern" value="%date [%thread] %-5level %logger - %message%newline" /> |
| | | </layout> |
| | | </appender> |
| | | <appender name="InfoLogger" type="log4net.Appender.RollingFileAppender"> |
| | | <file value="ç产æ¥å¿\Run\"/> |
| | | <appendToFile value="true" /> |
| | | <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> |
| | | <Encoding value="UTF-8" /> |
| | | <rollingStyle value="Composite" /> |
| | | <datePattern value="yyyy-MM/yyyy-MM-dd.'log'" /> |
| | | <maximumFileSize value="10MB" /> |
| | | <maxSizeRollBackups value="-1" /> |
| | | <StaticLogFileName value="true" /> |
| | | <createDirs value="true" /> |
| | | <filter type="log4net.Filter.LevelRangeFilter"> |
| | | <levelMin value="INFO" /> |
| | | <levelMax value="INFO" /> |
| | | </filter> |
| | | <layout type="log4net.Layout.PatternLayout"> |
| | | <param name="ConversionPattern" value="%date [%thread] %-5level %logger - %message%newline" /> |
| | | </layout> |
| | | </appender> |
| | | <appender name="WarnLogger" type="log4net.Appender.RollingFileAppender"> |
| | | <file value="ç产æ¥å¿\Warn\"/> |
| | | <appendToFile value="true" /> |
| | | <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> |
| | | <Encoding value="UTF-8" /> |
| | | <rollingStyle value="Composite" /> |
| | | <datePattern value="yyyy-MM/yyyy-MM-dd.'log'" /> |
| | | <maximumFileSize value="10MB" /> |
| | | <maxSizeRollBackups value="-1" /> |
| | | <StaticLogFileName value="true" /> |
| | | <createDirs value="true" /> |
| | | <filter type="log4net.Filter.LevelRangeFilter"> |
| | | <levelMin value="WARN" /> |
| | | <levelMax value="WARN" /> |
| | | </filter> |
| | | <layout type="log4net.Layout.PatternLayout"> |
| | | <param name="ConversionPattern" value="%date [%thread] %-5level %logger - %message%newline" /> |
| | | </layout> |
| | | </appender> |
| | | <appender name="ErrorLogger" type="log4net.Appender.RollingFileAppender"> |
| | | <file value="ç产æ¥å¿\Error\"/> |
| | | <appendToFile value="true" /> |
| | | <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> |
| | | <Encoding value="UTF-8" /> |
| | | <rollingStyle value="Composite" /> |
| | | <datePattern value="yyyy-MM/yyyy-MM-dd.'log'" /> |
| | | <maximumFileSize value="10MB" /> |
| | | <maxSizeRollBackups value="-1" /> |
| | | <StaticLogFileName value="true" /> |
| | | <createDirs value="true" /> |
| | | <filter type="log4net.Filter.LevelRangeFilter"> |
| | | <levelMin value="ERROR" /> |
| | | <levelMax value="ERROR" /> |
| | | </filter> |
| | | <layout type="log4net.Layout.PatternLayout"> |
| | | <param name="ConversionPattern" value="%date [%thread] %-5level %logger - %message%newline" /> |
| | | </layout> |
| | | </appender> |
| | | <appender name="FatalLogger" type="log4net.Appender.RollingFileAppender"> |
| | | <file value="ç产æ¥å¿\Fatal\"/> |
| | | <appendToFile value="true" /> |
| | | <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> |
| | | <Encoding value="UTF-8" /> |
| | | <rollingStyle value="Composite" /> |
| | | <datePattern value="yyyy-MM/yyyy-MM-dd.'log'" /> |
| | | <maximumFileSize value="10MB" /> |
| | | <maxSizeRollBackups value="-1" /> |
| | | <StaticLogFileName value="true" /> |
| | | <createDirs value="true" /> |
| | | <filter type="log4net.Filter.LevelRangeFilter"> |
| | | <levelMin value="FATAL" /> |
| | | <levelMax value="FATAL" /> |
| | | </filter> |
| | | <layout type="log4net.Layout.PatternLayout"> |
| | | <param name="ConversionPattern" value="%date [%thread] %-5level %logger - %message%newline" /> |
| | | </layout> |
| | | </appender> |
| | | </log4net> |
| | | </configuration> |
| | |
| | | { |
| | | if (InputImage is Bitmap) |
| | | { |
| | | TAlgorithm.Bitmap2Mat((Bitmap)InputImage, out Mat src); |
| | | Bitmap2Mat((Bitmap)InputImage, out Mat src); |
| | | |
| | | if (Params.Fixture == null) |
| | | Params.Fixture = new Fixture(); |
| | |
| | | |
| | | // 4. å建ä¸åå¾å¤§å°ç¸åçMatï¼å¹¶åå§åæ æå¼ |
| | | image = new Mat(src.Size(), src.Type()); |
| | | ((Mat)image).SetTo(TAlgorithm.GetInvalidValueForMat(src)); // å
¨é¨åå§åä¸ºæ æå¼ |
| | | ((Mat)image).SetTo(GetInvalidValueForMat(src)); // å
¨é¨åå§åä¸ºæ æå¼ |
| | | |
| | | // 5. å建é®ç½©ï¼å¨resultä¸ç»å¶æè½¬ç©å½¢ï¼ç½è²å¡«å
ï¼ |
| | | using (Mat cropped = new Mat(src, boundingRect)) |
| | |
| | | |
| | | // 2. å建ä¸åå¾å¤§å°ç¸åçMatï¼å¹¶åå§åæ æå¼ |
| | | image = new Mat(src.Size(), src.Type()); |
| | | ((Mat)image).SetTo(TAlgorithm.GetInvalidValueForMat(src)); // å
¨é¨åå§åä¸ºæ æå¼ |
| | | ((Mat)image).SetTo(GetInvalidValueForMat(src)); // å
¨é¨åå§åä¸ºæ æå¼ |
| | | |
| | | // 3. å建åå½¢é®ç½© |
| | | using (Mat mask = Mat.Zeros(src.Rows, src.Cols, MatType.CV_8UC1)) |
| | |
| | | image = ((Bitmap)InputImage)?.Clone(); |
| | | return true; |
| | | } |
| | | TAlgorithm.Mat2Bitmap((Mat)image, out Bitmap bmp); |
| | | Mat2Bitmap((Mat)image, out Bitmap bmp); |
| | | image = bmp; |
| | | return true; |
| | | } |
| | | else if (InputImage is HObject ho_image) |
| | | { |
| | | if (!ho_image.IsInitialized()) |
| | | return false; |
| | | |
| | | if (Params.Fixture == null) |
| | | Params.Fixture = new Fixture(); |
| | | |
| | | HObject hoDomainImage = null; |
| | | |
| | | switch (Params.ROI?.GetType().Name) |
| | | { |
| | | case "HRectangle2": |
| | | HOperatorSet.GenRectangle2(out HObject hRectangle2, (HTuple)(Params.ROI.Row + Params.Fixture.Row), (HTuple)(Params.ROI.Column + Params.Fixture.Column) |
| | | , (HTuple)(Params.ROI.Phi + Params.Fixture.Phi), (HTuple)((HRectangle2)Params.ROI).SemiLength1, (HTuple)((HRectangle2)Params.ROI).SemiLength2); |
| | | HOperatorSet.ReduceDomain(ho_image, hRectangle2, out hoDomainImage); |
| | | break; |
| | | case "HCircle": |
| | | HOperatorSet.GenCircle(out HObject hCircle, (HTuple)(Params.ROI.Row + Params.Fixture.Row), (HTuple)(Params.ROI.Column + Params.Fixture.Column) |
| | | , (HTuple)((HCircle)Params.ROI).Radius); |
| | | HOperatorSet.ReduceDomain(ho_image, hCircle, out hoDomainImage); |
| | | break; |
| | | case "ROI": |
| | | default: |
| | | image = ho_image.CopyObj(1, -1); |
| | | return true; |
| | | } |
| | | |
| | | image = hoDomainImage; |
| | | return true; |
| | | } |
| | | else if (InputImage is Mat) |
| | |
| | | |
| | | // 4. å建ä¸åå¾å¤§å°ç¸åçMatï¼å¹¶åå§åæ æå¼ |
| | | image = new Mat(src.Size(), src.Type()); |
| | | ((Mat)image).SetTo(TAlgorithm.GetInvalidValueForMat(src)); // å
¨é¨åå§åä¸ºæ æå¼ |
| | | ((Mat)image).SetTo(GetInvalidValueForMat(src)); // å
¨é¨åå§åä¸ºæ æå¼ |
| | | |
| | | // 5. å建é®ç½©ï¼å¨resultä¸ç»å¶æè½¬ç©å½¢ï¼ç½è²å¡«å
ï¼ |
| | | using (Mat cropped = new Mat(src, boundingRect)) |
| | |
| | | |
| | | // 2. å建ä¸åå¾å¤§å°ç¸åçMatï¼å¹¶åå§åæ æå¼ |
| | | image = new Mat(src.Size(), src.Type()); |
| | | ((Mat)image).SetTo(TAlgorithm.GetInvalidValueForMat(src)); // å
¨é¨åå§åä¸ºæ æå¼ |
| | | ((Mat)image).SetTo(GetInvalidValueForMat(src)); // å
¨é¨åå§åä¸ºæ æå¼ |
| | | |
| | | // 3. å建åå½¢é®ç½© |
| | | using (Mat mask = Mat.Zeros(src.Rows, src.Cols, MatType.CV_8UC1)) |
| | |
| | | } |
| | | } |
| | | |
| | | public virtual bool ReduceDomainImage(object InputImage, ref HImage image) |
| | | { |
| | | image = null; |
| | | if (InputImage == null) |
| | | { |
| | | image = null; |
| | | Msg = "è¾å
¥å¾ç为空"; |
| | | Result = false; |
| | | return false; |
| | | } |
| | | |
| | | lock (InputImage) |
| | | { |
| | | try |
| | | { |
| | | if (InputImage is HImage ho_image) |
| | | { |
| | | if (!ho_image.IsInitialized()) |
| | | return false; |
| | | |
| | | if (Params.Fixture == null) |
| | | Params.Fixture = new Fixture(); |
| | | |
| | | HImage hoDomainImage = null; |
| | | |
| | | switch (Params.ROI?.GetType().Name) |
| | | { |
| | | case "HRectangle2": |
| | | using (HRegion hRectangle2 = new HRegion()) |
| | | { |
| | | hRectangle2.GenRectangle2((HTuple)(Params.ROI.Row + Params.Fixture.Row), (HTuple)(Params.ROI.Column + Params.Fixture.Column) |
| | | , (HTuple)(Params.ROI.Phi + Params.Fixture.Phi), (HTuple)((HRectangle2)Params.ROI).SemiLength1, (HTuple)((HRectangle2)Params.ROI).SemiLength2); |
| | | hoDomainImage = ho_image.ReduceDomain(hRectangle2); |
| | | } |
| | | break; |
| | | case "HCircle": |
| | | using (HRegion hCircle = new HRegion()) |
| | | { |
| | | hCircle.GenCircle((HTuple)(Params.ROI.Row + Params.Fixture.Row), (HTuple)(Params.ROI.Column + Params.Fixture.Column) |
| | | , (HTuple)((HCircle)Params.ROI).Radius); |
| | | hoDomainImage = ho_image.ReduceDomain(hCircle); |
| | | } |
| | | break; |
| | | case "ROI": |
| | | default: |
| | | image = ho_image.CopyObj(1, -1); |
| | | return true; |
| | | } |
| | | |
| | | image = hoDomainImage; |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | image = null; |
| | | Msg = $"è¾å
¥æ ¼å¼ä¸æ£ç¡®{InputImage.GetType()}"; |
| | | Result = false; |
| | | return false; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | image = null; |
| | | Msg = $"è£åªåºå失败,åå æ¯:{ex.ToString()}"; |
| | | Result = false; |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | 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; |
| | | } |
| | | |
| | | if (Record != null) |
| | | { |
| | | Record.Dispose(); |
| | |
| | | if (InputImage != null) |
| | | { |
| | | if (InputImage is HObject ho_image && ho_image.IsInitialized()) |
| | | { |
| | | obj.InputImage = ho_image.CopyObj(1, -1); |
| | | } |
| | | else if (InputImage is Mat mat && !mat.Empty()) |
| | | { |
| | | obj.InputImage = mat.Clone(); |
| | | } |
| | | else if (InputImage is Bitmap bitmap) |
| | | { |
| | | obj.InputImage = bitmap.Clone(); |
| | | } |
| | | } |
| | | |
| | | return obj; |
| | | } |
| | | catch { return (TAlgorithm)MemberwiseClone(); } |
| | |
| | | { |
| | | Result = true; |
| | | bCompleted = false; |
| | | Msg = ""; |
| | | OutputImage = null; |
| | | |
| | | Msg = string.Empty; |
| | | //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 (Record != null) |
| | | { |
| | | Record.Dispose(); |
| | | } |
| | | } |
| | | |
| | | public override bool Run() |
| | | { |
| | | DateTime StartTime = DateTime.Now; |
| | | |
| | | InitRunParams(); |
| | | HOperatorSet.GenEmptyObj(out HObject EmptyObj); |
| | | OutputImage = EmptyObj; |
| | |
| | | |
| | | Thread.Sleep(30); |
| | | } |
| | | |
| | | Msg = "è¿è¡è¶
æ¶"; |
| | | Result = false; |
| | | RunTime = (DateTime.Now - StartTime).TotalMilliseconds; |
| | |
| | | try |
| | | { |
| | | if (string.IsNullOrEmpty(fullPath)) |
| | | { |
| | | return false; |
| | | |
| | | } |
| | | if (!fullPath.Contains(".json")) |
| | | { |
| | | Debug.WriteLine("æä»¶è·¯å¾ä¸å®æ´"); |
| | |
| | | Debug.WriteLine("æä»¶è·¯å¾ä¸å®æ´"); |
| | | return false; |
| | | } |
| | | |
| | | // è·åä¸å¸¦æä»¶åçç®å½è·¯å¾ |
| | | string directoryPath = Path.GetDirectoryName(fullPath); |
| | | strProcessName = Path.GetFileNameWithoutExtension(fullPath); |
| | |
| | | Save(directoryPath); |
| | | return true; |
| | | } |
| | | |
| | | string strJson = string.Empty; |
| | | using (StreamReader streamReader = new StreamReader(fullPath, Encoding.UTF8)) |
| | | { |
| | |
| | | } |
| | | Params = JsonConvert.DeserializeObject<ProcessParams>(strJson); |
| | | if (Params == null) |
| | | { |
| | | return false; |
| | | |
| | | } |
| | | Params.FixDeserializedData(); |
| | | return true; |
| | | } |
| | |
| | | return value; |
| | | } |
| | | |
| | | public static void Bitmap2HObject(Bitmap bmp, out HObject image) |
| | | public static HImage Bitmap2HObject(Bitmap bmp) |
| | | { |
| | | BitmapData srcBmpData; |
| | | |
| | | HImage image = null; |
| | | try |
| | | { |
| | | if (bmp == null || bmp.Width == 0 || bmp.Height == 0) |
| | | if (bmp.Tag != null && bmp == null || bmp.Width == 0 || bmp.Height == 0) |
| | | { |
| | | image = null; |
| | | return; |
| | | return image; |
| | | } |
| | | |
| | | lock (bmp) |
| | | { |
| | | image = new HImage(); |
| | | switch (bmp.PixelFormat) |
| | | { |
| | | case PixelFormat.Format24bppRgb: |
| | |
| | | int width = bmp.Width; |
| | | int height = bmp.Height; |
| | | int stride = srcBmpData.Stride; |
| | | |
| | | if (stride == width * 3) |
| | | HOperatorSet.GenImageInterleaved(out image, srcBmpData.Scan0, "bgr", bmp.Width, bmp.Height, 0, "byte", 0, 0, 0, 0, -1, 0); |
| | | { |
| | | image.GenImageInterleaved(srcBmpData.Scan0, "bgr", bmp.Width, bmp.Height, 0, "byte", 0, 0, 0, 0, -1, 0); |
| | | } |
| | | else |
| | | { |
| | | image = HandleStrideAlignmentBest(srcBmpData.Scan0, width, height, stride); |
| | | |
| | | } |
| | | bmp.UnlockBits(srcBmpData); |
| | | break; |
| | | default: |
| | | srcBmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format8bppIndexed); |
| | | HOperatorSet.GenImage1(out image, "byte", bmp.Width, bmp.Height, srcBmpData.Scan0); |
| | | image.GenImage1("byte", bmp.Width, bmp.Height, srcBmpData.Scan0); |
| | | bmp.UnlockBits(srcBmpData); |
| | | break; |
| | | } |
| | | } |
| | | return; |
| | | return image; |
| | | } |
| | | catch |
| | | { |
| | | if (image != null) |
| | | { |
| | | image.Dispose(); |
| | | } |
| | | image = null; |
| | | return; |
| | | return image; |
| | | } |
| | | } |
| | | |
| | | private static HObject HandleStrideAlignmentBest(IntPtr scan0, int width, int height, int stride) |
| | | private static HImage HandleStrideAlignmentBest(IntPtr scan0, int width, int height, int stride) |
| | | { |
| | | int expectedStride = width * 3; |
| | | byte[] alignedData = new byte[width * height * 3]; |
| | | |
| | | HImage image = new HImage(); |
| | | unsafe |
| | | { |
| | | byte* srcPtr = (byte*)scan0; |
| | |
| | | expectedStride |
| | | ); |
| | | } |
| | | HOperatorSet.GenImageInterleaved(out HObject ho_img, new IntPtr(dstPtr), "bgr", width, height, 0, "byte", width, height, 0, 0, -1, 0); |
| | | return ho_img; |
| | | image.GenImageInterleaved(new IntPtr(dstPtr), "bgr", width, height, 0, "byte", width, height, 0, 0, -1, 0); |
| | | return image; |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static unsafe void HObject2Bitmap(HObject hObject, out Bitmap bmp) |
| | | public static unsafe void HObject2Bitmap(HImage hImage, out Bitmap bmp) |
| | | { |
| | | try |
| | | { |
| | | if (hObject == null || !hObject.IsInitialized()) |
| | | if (hImage == null || !hImage.IsInitialized()) |
| | | { |
| | | bmp = null; |
| | | return; |
| | | } |
| | | |
| | | // è·åå¾åä¿¡æ¯ |
| | | HOperatorSet.GetImageSize(hObject, out HTuple width, out HTuple height); |
| | | HOperatorSet.CountChannels(hObject, out HTuple channels); |
| | | hImage.GetImageSize(out HTuple width, out HTuple height); |
| | | HTuple channels = hImage.CountChannels(); |
| | | |
| | | if (channels.I == 1) |
| | | { |
| | | // ç°åº¦å¾å¤ç |
| | | HTuple ptr, type; |
| | | HOperatorSet.GetImagePointer1(hObject, out ptr, out type, out width, out height); |
| | | ptr = hImage.GetImagePointer1(out type, out width, out height); |
| | | |
| | | bmp = new Bitmap(width, height, PixelFormat.Format8bppIndexed); |
| | | |
| | |
| | | { |
| | | // 彩è²å¾å¤çï¼BGR顺åºï¼ |
| | | HTuple ptrR, ptrG, ptrB, type; |
| | | HOperatorSet.GetImagePointer3(hObject, out ptrR, out ptrG, out ptrB, out type, out width, out height); |
| | | hImage.GetImagePointer3(out ptrR, out ptrG, out ptrB, out type, out width, out height); |
| | | |
| | | bmp = new Bitmap(width, height, PixelFormat.Format24bppRgb); |
| | | BitmapData bmpData = bmp.LockBits( |
| | |
| | | } |
| | | } |
| | | |
| | | public static void Mat2HObject(Mat mat, out HObject image) |
| | | public static HImage Mat2HObject(Mat mat) |
| | | { |
| | | HImage image = null; |
| | | try |
| | | { |
| | | if (mat == null || mat.Empty()) |
| | | { |
| | | image = null; |
| | | return; |
| | | return image; |
| | | } |
| | | |
| | | if (mat.Type() == MatType.CV_8UC3) // 彩è²å¾å (BGR) |
| | | { |
| | | HOperatorSet.GenImageInterleaved( |
| | | out image, |
| | | image = new HImage(); |
| | | image.GenImageInterleaved( |
| | | mat.Data, |
| | | "bgr", |
| | | mat.Width, |
| | |
| | | } |
| | | else if (mat.Type() == MatType.CV_8UC1) // ç°åº¦å¾å |
| | | { |
| | | HOperatorSet.GenImage1( |
| | | out image, |
| | | image = new HImage(); |
| | | image.GenImage1( |
| | | "byte", |
| | | mat.Width, |
| | | mat.Height, |
| | |
| | | { |
| | | throw new ArgumentException($"Mat2HObject䏿¯æçå¾åæ ¼å¼ï¼{mat.Type()}"); |
| | | } |
| | | return; |
| | | return image; |
| | | } |
| | | catch |
| | | { |
| | | image = null; |
| | | return; |
| | | return image; |
| | | } |
| | | } |
| | | |
| | |
| | | /// <param name="startPoint"></param> |
| | | /// <param name="endPoint"></param> |
| | | /// <returns></returns> |
| | | public static double GetDistanceP2P(HPoint startPoint, HPoint endPoint) |
| | | public double GetDistanceP2P(HPoint startPoint, HPoint endPoint) |
| | | { |
| | | try |
| | | { |
| | |
| | | catch { return 9994; } |
| | | } |
| | | |
| | | public static double GetDistanceP2P(Point startPoint, Point endPoint) |
| | | public double GetDistanceP2P(Point startPoint, Point endPoint) |
| | | { |
| | | return GetDistanceP2P(new HPoint(startPoint), new HPoint(endPoint)); |
| | | } |
| | | |
| | | public static double DistanceP2P(double startX, double startY, double endX, double endY) |
| | | public double DistanceP2P(double startX, double startY, double endX, double endY) |
| | | { |
| | | return GetDistanceP2P(new HPoint(startX, startY), new HPoint(endX, endY)); |
| | | } |
| | |
| | | /// <param name="startPoint"></param> |
| | | /// <param name="endPoint"></param> |
| | | /// <returns></returns> |
| | | public static HPoint GetMidPoint(HPoint startPoint, HPoint endPoint) |
| | | public HPoint GetMidPoint(HPoint startPoint, HPoint endPoint) |
| | | { |
| | | return new HPoint((startPoint.X + endPoint.X) / 2, (startPoint.Y + endPoint.Y) / 2); |
| | | } |
| | | |
| | | public static Point GetMidPoint(Point startPoint, Point endPoint) |
| | | public Point GetMidPoint(Point startPoint, Point endPoint) |
| | | { |
| | | return new Point((startPoint.X + endPoint.X) / 2, (startPoint.Y + endPoint.Y) / 2); |
| | | } |
| | | |
| | | public static System.Drawing.Point GetMidPoint(System.Drawing.Point startPoint, System.Drawing.Point endPoint) |
| | | public System.Drawing.Point GetMidPoint(System.Drawing.Point startPoint, System.Drawing.Point endPoint) |
| | | { |
| | | return new System.Drawing.Point((startPoint.X + endPoint.X) / 2, (startPoint.Y + endPoint.Y) / 2); |
| | | } |
| | |
| | | /// <param name="point"></param> |
| | | /// <param name="segment"></param> |
| | | /// <returns></returns> |
| | | public static bool IsPointOnSegment(HPoint pt, HSegment segment, double tolerance = 1e-3) |
| | | public bool IsPointOnSegment(HPoint pt, HSegment segment, double tolerance = 1e-3) |
| | | { |
| | | // 计ç®ç´çº¿æ¹ç¨çç³»æ° |
| | | double A = segment.EndY - segment.StartX; |
| | |
| | | return false; |
| | | } |
| | | |
| | | public static bool IsPointOnSegment(double px, double py, double x1, double y1, double x2, double y2) |
| | | public bool IsPointOnSegment(double px, double py, double x1, double y1, double x2, double y2) |
| | | { |
| | | return IsPointOnSegment(new HPoint(px, py), new HSegment(x1, y1, x2, y2)); |
| | | } |
| | |
| | | catch { return false; } |
| | | } |
| | | |
| | | public static bool IsPointNearRectangleSilde(HPoint pt, HRectangle2 rect, double tolerance = 100) |
| | | public bool IsPointNearRectangleSilde(HPoint pt, HRectangle2 rect, double tolerance = 100) |
| | | { |
| | | return IsPointNearRectangleSilde(new System.Drawing.Point((int)pt.X, (int)pt.Y), new Rectangle((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height), tolerance); |
| | | } |
| | |
| | | /// <param name="pt2"></param> |
| | | /// <param name="tolerance"></param> |
| | | /// <returns></returns> |
| | | public static bool IsPointNearPoint(HPoint pt1, HPoint pt2, double tolerance = 100) |
| | | public bool IsPointNearPoint(HPoint pt1, HPoint pt2, double tolerance = 100) |
| | | { |
| | | if (GetDistanceP2P(pt1, pt2) <= tolerance) |
| | | return true; |
| | | return false; |
| | | } |
| | | |
| | | public static bool IsPointNearPoint(Point pt1, Point pt2, double tolerance = 100) |
| | | public bool IsPointNearPoint(Point pt1, Point pt2, double tolerance = 100) |
| | | { |
| | | if (GetDistanceP2P(pt1, pt2) <= tolerance) |
| | | return true; |
| | | return false; |
| | | } |
| | | |
| | | public static bool IsPointNearPoint(double x1, double y1, double x2, double y2, int tolerance = 100) |
| | | public bool IsPointNearPoint(double x1, double y1, double x2, double y2, int tolerance = 100) |
| | | { |
| | | return IsPointNearPoint(new HPoint(x1, y1), new HPoint(x2, y2), tolerance); |
| | | } |
| | |
| | | /// <param name="corner"></param> |
| | | /// <param name="tolerance"></param> |
| | | /// <returns></returns> |
| | | public static bool IsPointNearRectangleCorner(Point pt, Rectangle rect, out string corner, double tolerance = 10) |
| | | public bool IsPointNearRectangleCorner(Point pt, Rectangle rect, out string corner, double tolerance = 10) |
| | | { |
| | | try |
| | | { |
| | |
| | | catch { corner = ""; return false; } |
| | | } |
| | | |
| | | public static bool IsPointNearRectangleCorner(HPoint pt, HRectangle2 rect, out string corner, double tolerance = 10) |
| | | public bool IsPointNearRectangleCorner(HPoint pt, HRectangle2 rect, out string corner, double tolerance = 10) |
| | | { |
| | | try |
| | | { |
| | |
| | | /// <param name="p3">线2èµ·å§ç¹</param> |
| | | /// <param name="p4"></param> |
| | | /// <returns></returns> |
| | | public static Point2d? GetLineIntersection(Point2d p1, Point2d p2, Point2d p3, Point2d p4, bool bOnSegment = false) |
| | | public Point2d? GetLineIntersection(Point2d p1, Point2d p2, Point2d p3, Point2d p4, bool bOnSegment = false) |
| | | { |
| | | // ç´çº¿1çåé |
| | | double x1 = p1.X, y1 = p1.Y; |
| | |
| | | #region Halcon |
| | | // Chapter: Graphics / Output |
| | | // Short Description: Display 3D object models |
| | | public static void visualize_object_model_3d(HTuple hv_WindowHandle, HTuple hv_ObjectModel3D, |
| | | public void visualize_object_model_3d(HTuple hv_WindowHandle, HTuple hv_ObjectModel3D, |
| | | HTuple hv_CamParam, HTuple hv_PoseIn, HTuple hv_GenParamName, HTuple hv_GenParamValue, |
| | | HTuple hv_Title, HTuple hv_Label, HTuple hv_Information, out HTuple hv_PoseOut) |
| | | { |
| | |
| | | |
| | | // Chapter: Calibration / Camera Parameters |
| | | // Short Description: Set the value of a specified camera parameter in the camera parameter tuple. |
| | | public static void set_cam_par_data(HTuple hv_CameraParamIn, HTuple hv_ParamName, HTuple hv_ParamValue, |
| | | public void set_cam_par_data(HTuple hv_CameraParamIn, HTuple hv_ParamName, HTuple hv_ParamValue, |
| | | out HTuple hv_CameraParamOut) |
| | | { |
| | | // Local iconic variables |
| | |
| | | } |
| | | } |
| | | |
| | | public static void gen_arrow_contour_xld(out HObject ho_Arrow, HTuple hv_Row1, HTuple hv_Column1, |
| | | public void gen_arrow_contour_xld(out HObject ho_Arrow, HTuple hv_Row1, HTuple hv_Column1, |
| | | HTuple hv_Row2, HTuple hv_Column2, HTuple hv_HeadLength, HTuple hv_HeadWidth) |
| | | { |
| | | // Stack for temporary objects |
| | |
| | | } |
| | | } |
| | | |
| | | public static void get_rect2_vertex(HTuple hv_Row, HTuple hv_Column, HTuple hv_Phi, HTuple hv_Length1, |
| | | public void get_rect2_vertex(HTuple hv_Row, HTuple hv_Column, HTuple hv_Phi, HTuple hv_Length1, |
| | | HTuple hv_Length2, out HTuple hv_TopLeft_Row, out HTuple hv_TopLeft_Col, out HTuple hv_TopRight_Row, |
| | | out HTuple hv_TopRight_Col, out HTuple hv_LowLeft_Row, out HTuple hv_LowLeft_Col, |
| | | out HTuple hv_LowRight_Row, out HTuple hv_LowRight_Col) |
| | |
| | | } |
| | | } |
| | | |
| | | public static void pts_to_best_line(out HObject ho_LineXld, HTuple hv_Rows, HTuple hv_Columns, |
| | | public void pts_to_best_line(out HObject ho_LineXld, HTuple hv_Rows, HTuple hv_Columns, |
| | | HTuple hv_IgnoreNum, out HTuple hv_Row1, out HTuple hv_Column1, out HTuple hv_Row2, |
| | | out HTuple hv_Column2) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | public static (double, double) CalculateTailValues(HTuple minValue, HTuple maxValue, HTuple mean, HTuple deviation, double tailPercentage = 0.3) |
| | | public (double, double) CalculateTailValues(HTuple minValue, HTuple maxValue, HTuple mean, HTuple deviation, double tailPercentage = 0.3) |
| | | { |
| | | // 计ç®ä½å°¾ç°åº¦å¼ |
| | | double lowTailValue = minValue.TupleReal() + (mean.TupleReal() - minValue.TupleReal()) * tailPercentage; |
| | |
| | | /// <param name="hv_Column2">ç»ææ¨ªåæ </param> |
| | | /// <param name="hv_ResultRow">ç»æç¹éåçºµåæ </param> |
| | | /// <param name="hv_ResultColumn">ç»æç¹é忍ªåæ </param> |
| | | public static void Rake(HObject ho_Image, out HObject ho_Regions, HTuple hv_Elements, |
| | | public void Rake(HObject ho_Image, out HObject ho_Regions, HTuple hv_Elements, |
| | | HTuple hv_DetectHeight, HTuple hv_DetectWidth, HTuple hv_Sigma, HTuple hv_Threshold, |
| | | HTuple hv_Transition, HTuple hv_Select, HTuple hv_Row1, HTuple hv_Column1, HTuple hv_Row2, |
| | | HTuple hv_Column2, out HTuple hv_ResultRow, out HTuple hv_ResultColumn) |
| | |
| | | catch { } |
| | | } |
| | | |
| | | public static void scale_gray_map(HObject ho_Image, out HObject ho_Image1, HTuple hv_Min, HTuple hv_Max) |
| | | public void scale_gray_map(HObject ho_Image, out HObject ho_Image1, HTuple hv_Min, HTuple hv_Max) |
| | | { |
| | | HTuple hv_Mult = new HTuple(), hv_Add = new HTuple(); |
| | | HOperatorSet.GenEmptyObj(out ho_Image1); |
| | |
| | | |
| | | #region OpenCVSharp |
| | | // æ ¹æ®Matç±»åè¿å对åºçæ æå¼ |
| | | public static Scalar GetInvalidValueForMat(Mat mat) |
| | | public Scalar GetInvalidValueForMat(Mat mat) |
| | | { |
| | | MatType type = mat.Type(); |
| | | if (type == MatType.CV_8UC1 || type == MatType.CV_8UC3) |
| | |
| | | return new Scalar(0); // 对äº8使 符å·ç±»åï¼0æ¯å®å
¨çæ æå¼ |
| | | } |
| | | |
| | | public static void RGB2XYZ(double sR, double sG, double sB, out double X, out double Y, out double Z) |
| | | public void RGB2XYZ(double sR, double sG, double sB, out double X, out double Y, out double Z) |
| | | { |
| | | // è¾å
¥çé¢è²å¼ (sR, sG, sB) åºä¸º 0 å° 255 ä¹é´çå¼ |
| | | |
| | |
| | | Z = Math.Round(var_Z / (var_X + var_Y + var_Z), 3); |
| | | } |
| | | |
| | | public static void ExtractFrames(string videoPath, string outputDir) |
| | | public void ExtractFrames(string videoPath, string outputDir) |
| | | { |
| | | // æ£æ¥è§é¢æä»¶æ¯å¦åå¨ |
| | | if (!File.Exists(videoPath)) |
| | |
| | | get |
| | | { |
| | | if (Subject == null) |
| | | { |
| | | return null; |
| | | } |
| | | return Subject.InputImage; |
| | | } |
| | | set |
| | | { |
| | | Subject.InputImage = value; |
| | | |
| | | if (InputImage == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | if (InputImage is HObject) |
| | | { |
| | | inputImageHSmartWindowControl.ShowHoImage((HObject)value); |
| | | } |
| | | else if (InputImage is Bitmap) |
| | | { |
| | | TAlgorithm.Bitmap2HObject((Bitmap)value, out HObject image); |
| | | inputImageHSmartWindowControl.ShowHoImage(image); |
| | | using (HImage image = TAlgorithm.Bitmap2HObject((Bitmap)value)) |
| | | { |
| | | inputImageHSmartWindowControl.ShowHoImage(image); |
| | | } |
| | | } |
| | | else if (InputImage is Mat) |
| | | { |
| | | TAlgorithm.Mat2HObject((Mat)value, out HObject image); |
| | | inputImageHSmartWindowControl.ShowHoImage(image); |
| | | using (HImage image = TAlgorithm.Mat2HObject((Mat)value)) |
| | | { |
| | | inputImageHSmartWindowControl.ShowHoImage(image); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | if (Subject.OutputImage is Mat) |
| | | { |
| | | TAlgorithm.Mat2HObject((Mat)Subject.OutputImage, out HObject image); |
| | | recordImageHSmartWindowControl.ShowHoImage(image); |
| | | using (HImage image = TAlgorithm.Mat2HObject((Mat)Subject.OutputImage)) |
| | | { |
| | | recordImageHSmartWindowControl.ShowHoImage(image); |
| | | } |
| | | } |
| | | else if (Subject.OutputImage is Bitmap) |
| | | { |
| | | TAlgorithm.Bitmap2HObject((Bitmap)Subject.OutputImage, out HObject image); |
| | | recordImageHSmartWindowControl.ShowHoImage(image); |
| | | using (HImage image = TAlgorithm.Bitmap2HObject((Bitmap)Subject.OutputImage)) |
| | | { |
| | | recordImageHSmartWindowControl.ShowHoImage(image); |
| | | } |
| | | } |
| | | else if (Subject.OutputImage is HObject) |
| | | { |
| | | recordImageHSmartWindowControl.ShowHoImage((HObject)Subject.OutputImage); |
| | | } |
| | | } |
| | | |
| | | //å
夿åç±»å夿ç¶ç±» |
| | | if (Subject.Record != null && Subject.Record is MsgRecord msgRecord) |
| | | { |
| | |
| | | recordImageHSmartWindowControl.DispObj(msgRecord.RecordObject_NG, false); |
| | | |
| | | for (int i = 0; i < msgRecord.Msg.Length; i++) |
| | | { |
| | | recordImageHSmartWindowControl.ShowMsg(msgRecord.Msg[i] |
| | | , 1 == msgRecord.Result[i] ? true : false, msgRecord.Column[i], msgRecord.Row[i]); |
| | | } |
| | | } |
| | | else if (Subject.Record != null && Subject.Record is ObjectRecord objRecord) |
| | | { |
| | | recordImageHSmartWindowControl.DispObj(objRecord.RecordObject_OK, true); |
| | | recordImageHSmartWindowControl.DispObj(objRecord.RecordObject_NG, false); |
| | | } |
| | | |
| | | GC.Collect(); |
| | | })); |
| | | } |
| | |
| | | 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); |
| | | InputImage = null; |
| | | ((Bitmap)InputImage).Dispose(); |
| | | InputImage = hImage.Clone(); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Msg = "转å¾åºéï¼" + ex.Message; |
| | | Result = false; |
| | | return; |
| | | } |
| | | } |
| | | if (!(InputImage is HObject)) |
| | |
| | | } |
| | | |
| | | #region è£åªåºå |
| | | object DomainImage = null; |
| | | HImage DomainImage = null; |
| | | if (!ReduceDomainImage(InputImage, ref DomainImage)) |
| | | { |
| | | Msg = "è£åªåºå失败"; |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Drawing; |
| | | using System.Drawing.Imaging; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | |
| | | Result = false; |
| | | return; |
| | | } |
| | | if (InputImage is Bitmap) |
| | | { |
| | | try |
| | | { |
| | | 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)InputImage).Dispose(); |
| | | InputImage = hImage.Clone(); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Msg = "转å¾åºéï¼" + ex.Message; |
| | | Result = false; |
| | | return; |
| | | } |
| | | } |
| | | if (!(InputImage is HObject)) |
| | | { |
| | | Msg = "è¾å
¥å¾çæ ¼å¼ä¸ä¸ºMat"; |
| | |
| | | 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; |
| | |
| | | Result = false; |
| | | return; |
| | | } |
| | | |
| | | if (InputImage is Bitmap) |
| | | { |
| | | try |
| | | { |
| | | 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)InputImage).Dispose(); |
| | | InputImage = hImage.Clone(); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Msg = "转å¾åºéï¼" + ex.Message; |
| | | Result = false; |
| | | return; |
| | | } |
| | | } |
| | | if (!(InputImage is HObject)) |
| | | { |
| | | Msg = "è¾å
¥å¾çæ ¼å¼ä¸ä¸ºMat"; |
| | | Result = false; |
| | | return; |
| | | } |
| | | #region è£åªåºå |
| | | if (!(Params.ROI is HSegment)) |
| | | { |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Diagnostics; |
| | | using System.Drawing.Imaging; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | |
| | | Result = false; |
| | | return; |
| | | } |
| | | if (InputImage is Bitmap) |
| | | { |
| | | try |
| | | { |
| | | 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)InputImage).Dispose(); |
| | | InputImage = hImage.Clone(); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Msg = "转å¾åºéï¼" + ex.Message; |
| | | Result = false; |
| | | return; |
| | | } |
| | | } |
| | | if (!(InputImage is HObject)) |
| | | { |
| | | Msg = "è¾å
¥å¾çæ ¼å¼ä¸ä¸ºHObject"; |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Diagnostics; |
| | | using System.Drawing.Imaging; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | |
| | | Result = false; |
| | | return; |
| | | } |
| | | if (InputImage is Bitmap) |
| | | { |
| | | try |
| | | { |
| | | 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)InputImage).Dispose(); |
| | | InputImage = hImage.Clone(); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Msg = "转å¾åºéï¼"+ ex.Message; |
| | | Result = false; |
| | | return; |
| | | } |
| | | } |
| | | if (!(InputImage is HObject)) |
| | | { |
| | | Msg = "è¾å
¥å¾çæ ¼å¼ä¸ä¸ºMat"; |
| | |
| | | |
| | | if (Subject.InputImage != null && Subject.InputImage is Mat) |
| | | { |
| | | TAlgorithm.Mat2HObject((Mat)Subject.InputImage, out HObject image); |
| | | inputImageHSmartWindowControl.ShowHoImage(image); |
| | | using (HImage image = TAlgorithm.Mat2HObject((Mat)Subject.InputImage)) |
| | | { |
| | | inputImageHSmartWindowControl.ShowHoImage(image); |
| | | } |
| | | } |
| | | |
| | | Type type = Subject.Params.ROI?.GetType(); |
| | | if (Subject.Params.ROI != null) |
| | | { |
| | |
| | | |
| | | if (Subject.InputImage != null && Subject.InputImage is Mat) |
| | | { |
| | | TAlgorithm.Mat2HObject((Mat)Subject.InputImage, out HObject image); |
| | | HOperatorSet.GetImageSize(image, out HTuple ho_ImageWidth, out HTuple ho_ImageHeight); |
| | | recordImageHSmartWindowControl.ShowHoImage(image); |
| | | using (HImage image = TAlgorithm.Mat2HObject((Mat)Subject.InputImage)) |
| | | { |
| | | HOperatorSet.GetImageSize(image, out HTuple ho_ImageWidth, out HTuple ho_ImageHeight); |
| | | recordImageHSmartWindowControl.ShowHoImage(image); |
| | | } |
| | | } |
| | | |
| | | //å
夿åç±»å夿ç¶ç±» |
| | |
| | | { |
| | | recordImageHSmartWindowControl.DispObj(msgRecord.RecordObject_OK, true); |
| | | recordImageHSmartWindowControl.DispObj(msgRecord.RecordObject_NG, false); |
| | | |
| | | for (int i = 0; i < msgRecord.Msg.Length; i++) |
| | | { |
| | | recordImageHSmartWindowControl.ShowMsg(msgRecord.Msg[i] |
| | | , 1 == msgRecord.Result[i] ? true : false, msgRecord.Column[i], msgRecord.Row[i]); |
| | | } |
| | | } |
| | | else if (Subject.Record != null && Subject.Record is ObjectRecord objRecord) |
| | | { |
| | |
| | | HTuple hv_imageHeight = 0; |
| | | if (InputImage != null && InputImage is Mat) |
| | | { |
| | | TAlgorithm.Mat2HObject((Mat)InputImage, out HObject image); |
| | | HOperatorSet.GetImageSize(image, out hv_imageWidth, out hv_imageHeight); |
| | | } |
| | | switch (type) |
| | | { |
| | | case RoiType.Rectangle2: |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HRectangle2(hv_imageWidth.TupleReal() / 2, hv_imageHeight.TupleReal() / 2, 0 |
| | | , hv_imageWidth.TupleReal() / 4, hv_imageHeight.TupleReal() / 4); |
| | | break; |
| | | case RoiType.Circle: |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HCircle(hv_imageWidth.TupleReal() / 2, hv_imageHeight.TupleReal() / 2, hv_imageWidth.TupleReal() / 4); |
| | | break; |
| | | //case RoiType.Ellipse: |
| | | // inputImageHSmartWindowControl.oRoi |
| | | // = new HEllipse(hv_imageWidth.TupleReal() / 2, hv_imageHeight.TupleReal() / 2,0, hv_imageHeight.TupleReal() / 4, hv_imageWidth.TupleReal() / 4); |
| | | // break; |
| | | //case RoiType.Segment: |
| | | // inputImageHSmartWindowControl.oRoi |
| | | // = new HSegment(0, 0, hv_imageWidth.TupleReal() / 4, hv_imageHeight.TupleReal() / 4); |
| | | // break; |
| | | case RoiType.None: |
| | | default: |
| | | inputImageHSmartWindowControl.oRoi = null; |
| | | break; |
| | | using (HImage image = TAlgorithm.Mat2HObject((Mat)InputImage)) |
| | | { |
| | | image.GetImageSize(out hv_imageWidth, out hv_imageHeight); |
| | | switch (type) |
| | | { |
| | | case RoiType.Rectangle2: |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HRectangle2(hv_imageWidth.TupleReal() / 2, hv_imageHeight.TupleReal() / 2, 0 |
| | | , hv_imageWidth.TupleReal() / 4, hv_imageHeight.TupleReal() / 4); |
| | | break; |
| | | case RoiType.Circle: |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HCircle(hv_imageWidth.TupleReal() / 2, hv_imageHeight.TupleReal() / 2, hv_imageWidth.TupleReal() / 4); |
| | | break; |
| | | //case RoiType.Ellipse: |
| | | // inputImageHSmartWindowControl.oRoi |
| | | // = new HEllipse(hv_imageWidth.TupleReal() / 2, hv_imageHeight.TupleReal() / 2,0, hv_imageHeight.TupleReal() / 4, hv_imageWidth.TupleReal() / 4); |
| | | // break; |
| | | //case RoiType.Segment: |
| | | // inputImageHSmartWindowControl.oRoi |
| | | // = new HSegment(0, 0, hv_imageWidth.TupleReal() / 4, hv_imageHeight.TupleReal() / 4); |
| | | // break; |
| | | case RoiType.None: |
| | | default: |
| | | inputImageHSmartWindowControl.oRoi = null; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | if (Subject.InputImage != null && Subject.InputImage is Mat) |
| | | { |
| | | TAlgorithm.Mat2HObject((Mat)Subject.InputImage, out HObject image); |
| | | inputImageHSmartWindowControl.ShowHoImage(image); |
| | | } |
| | | |
| | | Type type = Subject.Params.ROI?.GetType(); |
| | | if (Subject.Params.ROI != null) |
| | | { |
| | | switch (type) |
| | | using (HImage image = TAlgorithm.Mat2HObject((Mat)Subject.InputImage)) |
| | | { |
| | | case Type t when t == typeof(HRectangle2): |
| | | cmbTypeRoi.Text = RoiType.Rectangle2.ToString(); |
| | | break; |
| | | case Type t when t == typeof(HCircle): |
| | | cmbTypeRoi.Text = RoiType.Circle.ToString(); |
| | | break; |
| | | case Type t when t == typeof(HSegment): |
| | | cmbTypeRoi.Text = RoiType.Segment.ToString(); |
| | | break; |
| | | default: |
| | | cmbTypeRoi.Text = RoiType.None.ToString(); |
| | | break; |
| | | inputImageHSmartWindowControl.ShowHoImage(image); |
| | | Type type = Subject.Params.ROI?.GetType(); |
| | | if (Subject.Params.ROI != null) |
| | | { |
| | | switch (type) |
| | | { |
| | | case Type t when t == typeof(HRectangle2): |
| | | cmbTypeRoi.Text = RoiType.Rectangle2.ToString(); |
| | | break; |
| | | case Type t when t == typeof(HCircle): |
| | | cmbTypeRoi.Text = RoiType.Circle.ToString(); |
| | | break; |
| | | case Type t when t == typeof(HSegment): |
| | | cmbTypeRoi.Text = RoiType.Segment.ToString(); |
| | | break; |
| | | default: |
| | | cmbTypeRoi.Text = RoiType.None.ToString(); |
| | | break; |
| | | } |
| | | if (cmbTypeRoi.Text.ToString() != "None") |
| | | ckbDrawRoi.Checked = true; |
| | | else |
| | | ckbDrawRoi.Checked = false; |
| | | |
| | | inputImageHSmartWindowControl.oRoi = Subject.Params.ROI; |
| | | } |
| | | |
| | | if (Subject.Params.Fixture != null) |
| | | cmbFixture.Text = Subject.Params.Fixture.strName; |
| | | else |
| | | cmbFixture.Text = ""; |
| | | |
| | | switch (type) |
| | | { |
| | | case Type t when t == typeof(HRectangle2): |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HRectangle2(Subject.Params.ROI.X + Subject.Params.Fixture.X, Subject.Params.ROI.Y + Subject.Params.Fixture.Y |
| | | , Subject.Params.ROI.Phi + Subject.Params.Fixture.Phi, ((HRectangle2)Subject.Params.ROI).Width, ((HRectangle2)Subject.Params.ROI).Height); |
| | | break; |
| | | case Type t when t == typeof(HCircle): |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HCircle(Subject.Params.ROI.X + Subject.Params.Fixture.X, Subject.Params.ROI.Y + Subject.Params.Fixture.Y |
| | | , ((HCircle)Subject.Params.ROI).Radius); |
| | | break; |
| | | case Type t when t == typeof(HSegment): |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HSegment(((HSegment)Subject.Params.ROI).StartX + Subject.Params.Fixture.X, ((HSegment)Subject.Params.ROI).StartY + Subject.Params.Fixture.Y |
| | | , ((HSegment)Subject.Params.ROI).EndX + Subject.Params.Fixture.X, ((HSegment)Subject.Params.ROI).EndY + Subject.Params.Fixture.Y); |
| | | break; |
| | | default: |
| | | inputImageHSmartWindowControl.oRoi = null; |
| | | break; |
| | | } |
| | | } |
| | | if (cmbTypeRoi.Text.ToString() != "None") |
| | | ckbDrawRoi.Checked = true; |
| | | else |
| | | ckbDrawRoi.Checked = false; |
| | | |
| | | inputImageHSmartWindowControl.oRoi = Subject.Params.ROI; |
| | | } |
| | | |
| | | if (Subject.Params.Fixture != null) |
| | | cmbFixture.Text = Subject.Params.Fixture.strName; |
| | | else |
| | | cmbFixture.Text = ""; |
| | | |
| | | switch (type) |
| | | { |
| | | case Type t when t == typeof(HRectangle2): |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HRectangle2(Subject.Params.ROI.X + Subject.Params.Fixture.X, Subject.Params.ROI.Y + Subject.Params.Fixture.Y |
| | | , Subject.Params.ROI.Phi + Subject.Params.Fixture.Phi, ((HRectangle2)Subject.Params.ROI).Width, ((HRectangle2)Subject.Params.ROI).Height); |
| | | break; |
| | | case Type t when t == typeof(HCircle): |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HCircle(Subject.Params.ROI.X + Subject.Params.Fixture.X, Subject.Params.ROI.Y + Subject.Params.Fixture.Y |
| | | , ((HCircle)Subject.Params.ROI).Radius); |
| | | break; |
| | | case Type t when t == typeof(HSegment): |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HSegment(((HSegment)Subject.Params.ROI).StartX + Subject.Params.Fixture.X, ((HSegment)Subject.Params.ROI).StartY + Subject.Params.Fixture.Y |
| | | , ((HSegment)Subject.Params.ROI).EndX + Subject.Params.Fixture.X, ((HSegment)Subject.Params.ROI).EndY + Subject.Params.Fixture.Y); |
| | | break; |
| | | default: |
| | | inputImageHSmartWindowControl.oRoi = null; |
| | | break; |
| | | } |
| | | })); |
| | | } |
| | |
| | | |
| | | if (Subject.InputImage != null && Subject.InputImage is Mat) |
| | | { |
| | | TAlgorithm.Mat2HObject((Mat)Subject.InputImage, out HObject image); |
| | | HOperatorSet.GetImageSize(image, out HTuple ho_ImageWidth, out HTuple ho_ImageHeight); |
| | | recordImageHSmartWindowControl.ShowHoImage(image); |
| | | } |
| | | using (HImage image = TAlgorithm.Mat2HObject((Mat)Subject.InputImage)) |
| | | { |
| | | image.GetImageSize(out HTuple ho_ImageWidth, out HTuple ho_ImageHeight); |
| | | recordImageHSmartWindowControl.ShowHoImage(image); |
| | | //å
夿åç±»å夿ç¶ç±» |
| | | if (Subject.Record != null && Subject.Record is MsgRecord msgRecord) |
| | | { |
| | | recordImageHSmartWindowControl.DispObj(msgRecord.RecordObject_OK, true); |
| | | recordImageHSmartWindowControl.DispObj(msgRecord.RecordObject_NG, false); |
| | | |
| | | //å
夿åç±»å夿ç¶ç±» |
| | | if (Subject.Record != null && Subject.Record is MsgRecord msgRecord) |
| | | { |
| | | recordImageHSmartWindowControl.DispObj(msgRecord.RecordObject_OK, true); |
| | | recordImageHSmartWindowControl.DispObj(msgRecord.RecordObject_NG, false); |
| | | |
| | | for (int i = 0; i < msgRecord.Msg.Length; i++) |
| | | recordImageHSmartWindowControl.ShowMsg(msgRecord.Msg[i] |
| | | , 1 == msgRecord.Result[i] ? true : false, msgRecord.Column[i], msgRecord.Row[i]); |
| | | for (int i = 0; i < msgRecord.Msg.Length; i++) |
| | | recordImageHSmartWindowControl.ShowMsg(msgRecord.Msg[i] |
| | | , 1 == msgRecord.Result[i] ? true : false, msgRecord.Column[i], msgRecord.Row[i]); |
| | | } |
| | | else if (Subject.Record != null && Subject.Record is ObjectRecord objRecord) |
| | | { |
| | | recordImageHSmartWindowControl.DispObj(objRecord.RecordObject_OK, true); |
| | | recordImageHSmartWindowControl.DispObj(objRecord.RecordObject_NG, false); |
| | | } |
| | | } |
| | | } |
| | | else if (Subject.Record != null && Subject.Record is ObjectRecord objRecord) |
| | | { |
| | | recordImageHSmartWindowControl.DispObj(objRecord.RecordObject_OK, true); |
| | | recordImageHSmartWindowControl.DispObj(objRecord.RecordObject_NG, false); |
| | | } |
| | | |
| | | GC.Collect(); |
| | | })); |
| | | } |
| | |
| | | HTuple hv_imageHeight = 0; |
| | | if (InputImage != null && InputImage is Mat) |
| | | { |
| | | TAlgorithm.Mat2HObject((Mat)InputImage, out HObject image); |
| | | HOperatorSet.GetImageSize(image, out hv_imageWidth, out hv_imageHeight); |
| | | } |
| | | switch (type) |
| | | { |
| | | case RoiType.Rectangle2: |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HRectangle2(hv_imageWidth.TupleReal() / 2, hv_imageHeight.TupleReal() / 2, 0 |
| | | , hv_imageWidth.TupleReal() / 4, hv_imageHeight.TupleReal() / 4); |
| | | break; |
| | | case RoiType.Circle: |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HCircle(hv_imageWidth.TupleReal() / 2, hv_imageHeight.TupleReal() / 2, hv_imageWidth.TupleReal() / 4); |
| | | break; |
| | | case RoiType.Segment: |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HSegment(0, 0, hv_imageWidth.TupleReal() / 4, hv_imageHeight.TupleReal() / 4); |
| | | break; |
| | | case RoiType.None: |
| | | default: |
| | | inputImageHSmartWindowControl.oRoi = null; |
| | | break; |
| | | using (HImage image=TAlgorithm.Mat2HObject((Mat)InputImage)) |
| | | { |
| | | image.GetImageSize(out hv_imageWidth, out hv_imageHeight); |
| | | switch (type) |
| | | { |
| | | case RoiType.Rectangle2: |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HRectangle2(hv_imageWidth.TupleReal() / 2, hv_imageHeight.TupleReal() / 2, 0 |
| | | , hv_imageWidth.TupleReal() / 4, hv_imageHeight.TupleReal() / 4); |
| | | break; |
| | | case RoiType.Circle: |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HCircle(hv_imageWidth.TupleReal() / 2, hv_imageHeight.TupleReal() / 2, hv_imageWidth.TupleReal() / 4); |
| | | break; |
| | | case RoiType.Segment: |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HSegment(0, 0, hv_imageWidth.TupleReal() / 4, hv_imageHeight.TupleReal() / 4); |
| | | break; |
| | | case RoiType.None: |
| | | default: |
| | | inputImageHSmartWindowControl.oRoi = null; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | if (InputImage != null && InputImage is Mat) |
| | | { |
| | | TAlgorithm.Mat2HObject((Mat)InputImage, out HObject image); |
| | | inputImageHSmartWindowControl.ShowHoImage(image); |
| | | using (HImage image = TAlgorithm.Mat2HObject((Mat)InputImage)) |
| | | { |
| | | inputImageHSmartWindowControl.ShowHoImage(image); |
| | | int hv_Elements = Convert.ToInt16(itxtCaliperCount.Text); |
| | | double hv_DetectHeight = Convert.ToDouble(dtxtCaliperHeight.Text); |
| | | double hv_DetectWidth = Convert.ToDouble(dtxtCaliperWidth.Text); |
| | | |
| | | double hv_Row1 = Convert.ToDouble(((HSegment)inputImageHSmartWindowControl.oRoi).BeginRow + Subject.Params.Fixture.Row); |
| | | double hv_Column1 = Convert.ToDouble(((HSegment)inputImageHSmartWindowControl.oRoi).BeginColumn + Subject.Params.Fixture.Column); |
| | | double hv_Row2 = Convert.ToDouble(((HSegment)inputImageHSmartWindowControl.oRoi).EndRow + Subject.Params.Fixture.Row); |
| | | double hv_Column2 = Convert.ToDouble(((HSegment)inputImageHSmartWindowControl.oRoi).EndColumn + Subject.Params.Fixture.Column); |
| | | |
| | | TAlgorithm.GetRakeRegions(null, out HObject ho_Regions, hv_Elements, hv_DetectHeight, hv_DetectWidth |
| | | , new HTuple(), new HTuple(), new HTuple(), new HTuple() |
| | | , hv_Row1, hv_Column1, hv_Row2, hv_Column2 |
| | | , out HTuple hv_ResultRow, out HTuple hv_ResultColumn); |
| | | |
| | | inputImageHSmartWindowControl.DispObj(ho_Regions); |
| | | } |
| | | } |
| | | |
| | | int hv_Elements = Convert.ToInt16(itxtCaliperCount.Text); |
| | | double hv_DetectHeight = Convert.ToDouble(dtxtCaliperHeight.Text); |
| | | double hv_DetectWidth = Convert.ToDouble(dtxtCaliperWidth.Text); |
| | | |
| | | double hv_Row1 = Convert.ToDouble(((HSegment)inputImageHSmartWindowControl.oRoi).BeginRow + Subject.Params.Fixture.Row); |
| | | double hv_Column1 = Convert.ToDouble(((HSegment)inputImageHSmartWindowControl.oRoi).BeginColumn + Subject.Params.Fixture.Column); |
| | | double hv_Row2 = Convert.ToDouble(((HSegment)inputImageHSmartWindowControl.oRoi).EndRow + Subject.Params.Fixture.Row); |
| | | double hv_Column2 = Convert.ToDouble(((HSegment)inputImageHSmartWindowControl.oRoi).EndColumn + Subject.Params.Fixture.Column); |
| | | |
| | | TAlgorithm.GetRakeRegions(null, out HObject ho_Regions, hv_Elements, hv_DetectHeight, hv_DetectWidth |
| | | , new HTuple(), new HTuple(), new HTuple(), new HTuple() |
| | | , hv_Row1, hv_Column1, hv_Row2, hv_Column2 |
| | | , out HTuple hv_ResultRow, out HTuple hv_ResultColumn); |
| | | |
| | | inputImageHSmartWindowControl.DispObj(ho_Regions); |
| | | } |
| | | catch { } |
| | | })); |
| | |
| | | |
| | | if (Subject.InputImage != null && Subject.InputImage is Mat) |
| | | { |
| | | TAlgorithm.Mat2HObject((Mat)Subject.InputImage, out HObject image); |
| | | inputImageHSmartWindowControl.ShowHoImage(image); |
| | | } |
| | | |
| | | Type type = Subject.Params.ROI?.GetType(); |
| | | if (Subject.Params.ROI != null) |
| | | { |
| | | switch (type) |
| | | using (HImage image = TAlgorithm.Mat2HObject((Mat)Subject.InputImage)) |
| | | { |
| | | case Type t when t == typeof(HRectangle2): |
| | | cmbTypeRoi.Text = RoiType.Rectangle2.ToString(); |
| | | break; |
| | | case Type t when t == typeof(HCircle): |
| | | cmbTypeRoi.Text = RoiType.Circle.ToString(); |
| | | break; |
| | | case Type t when t == typeof(HSegment): |
| | | cmbTypeRoi.Text = RoiType.Segment.ToString(); |
| | | break; |
| | | default: |
| | | cmbTypeRoi.Text = RoiType.None.ToString(); |
| | | break; |
| | | inputImageHSmartWindowControl.ShowHoImage(image); |
| | | Type type = Subject.Params.ROI?.GetType(); |
| | | if (Subject.Params.ROI != null) |
| | | { |
| | | switch (type) |
| | | { |
| | | case Type t when t == typeof(HRectangle2): |
| | | cmbTypeRoi.Text = RoiType.Rectangle2.ToString(); |
| | | break; |
| | | case Type t when t == typeof(HCircle): |
| | | cmbTypeRoi.Text = RoiType.Circle.ToString(); |
| | | break; |
| | | case Type t when t == typeof(HSegment): |
| | | cmbTypeRoi.Text = RoiType.Segment.ToString(); |
| | | break; |
| | | default: |
| | | cmbTypeRoi.Text = RoiType.None.ToString(); |
| | | break; |
| | | } |
| | | if (cmbTypeRoi.Text.ToString() != "None") |
| | | ckbDrawRoi.Checked = true; |
| | | else |
| | | ckbDrawRoi.Checked = false; |
| | | |
| | | inputImageHSmartWindowControl.oRoi = Subject.Params.ROI; |
| | | } |
| | | |
| | | if (Subject.Params.Fixture != null) |
| | | cmbFixture.Text = Subject.Params.Fixture.strName; |
| | | else |
| | | cmbFixture.Text = ""; |
| | | |
| | | switch (type) |
| | | { |
| | | case Type t when t == typeof(HRectangle2): |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HRectangle2(Subject.Params.ROI.X + Subject.Params.Fixture.X, Subject.Params.ROI.Y + Subject.Params.Fixture.Y |
| | | , Subject.Params.ROI.Phi + Subject.Params.Fixture.Phi, ((HRectangle2)Subject.Params.ROI).Width, ((HRectangle2)Subject.Params.ROI).Height); |
| | | break; |
| | | case Type t when t == typeof(HCircle): |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HCircle(Subject.Params.ROI.X + Subject.Params.Fixture.X, Subject.Params.ROI.Y + Subject.Params.Fixture.Y |
| | | , ((HCircle)Subject.Params.ROI).Radius); |
| | | break; |
| | | case Type t when t == typeof(HSegment): |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HSegment(((HSegment)Subject.Params.ROI).StartX + Subject.Params.Fixture.X, ((HSegment)Subject.Params.ROI).StartY + Subject.Params.Fixture.Y |
| | | , ((HSegment)Subject.Params.ROI).EndX + Subject.Params.Fixture.X, ((HSegment)Subject.Params.ROI).EndY + Subject.Params.Fixture.Y); |
| | | break; |
| | | default: |
| | | inputImageHSmartWindowControl.oRoi = null; |
| | | break; |
| | | } |
| | | |
| | | ShowModel(((FindModelTool)Subject).ModelID); |
| | | |
| | | } |
| | | if (cmbTypeRoi.Text.ToString() != "None") |
| | | ckbDrawRoi.Checked = true; |
| | | else |
| | | ckbDrawRoi.Checked = false; |
| | | |
| | | inputImageHSmartWindowControl.oRoi = Subject.Params.ROI; |
| | | } |
| | | |
| | | if (Subject.Params.Fixture != null) |
| | | cmbFixture.Text = Subject.Params.Fixture.strName; |
| | | else |
| | | cmbFixture.Text = ""; |
| | | |
| | | switch (type) |
| | | { |
| | | case Type t when t == typeof(HRectangle2): |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HRectangle2(Subject.Params.ROI.X + Subject.Params.Fixture.X, Subject.Params.ROI.Y + Subject.Params.Fixture.Y |
| | | , Subject.Params.ROI.Phi + Subject.Params.Fixture.Phi, ((HRectangle2)Subject.Params.ROI).Width, ((HRectangle2)Subject.Params.ROI).Height); |
| | | break; |
| | | case Type t when t == typeof(HCircle): |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HCircle(Subject.Params.ROI.X + Subject.Params.Fixture.X, Subject.Params.ROI.Y + Subject.Params.Fixture.Y |
| | | , ((HCircle)Subject.Params.ROI).Radius); |
| | | break; |
| | | case Type t when t == typeof(HSegment): |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HSegment(((HSegment)Subject.Params.ROI).StartX + Subject.Params.Fixture.X, ((HSegment)Subject.Params.ROI).StartY + Subject.Params.Fixture.Y |
| | | , ((HSegment)Subject.Params.ROI).EndX + Subject.Params.Fixture.X, ((HSegment)Subject.Params.ROI).EndY + Subject.Params.Fixture.Y); |
| | | break; |
| | | default: |
| | | inputImageHSmartWindowControl.oRoi = null; |
| | | break; |
| | | } |
| | | |
| | | ShowModel(((FindModelTool)Subject).ModelID); |
| | | })); |
| | | } |
| | | |
| | |
| | | |
| | | if (Subject.InputImage != null && Subject.InputImage is Mat) |
| | | { |
| | | TAlgorithm.Mat2HObject((Mat)Subject.InputImage, out HObject image); |
| | | HOperatorSet.GetImageSize(image, out HTuple ho_ImageWidth, out HTuple ho_ImageHeight); |
| | | recordImageHSmartWindowControl.ShowHoImage(image); |
| | | } |
| | | using (HImage image = TAlgorithm.Mat2HObject((Mat)Subject.InputImage)) |
| | | { |
| | | image.GetImageSize(out HTuple ho_ImageWidth, out HTuple ho_ImageHeight); |
| | | recordImageHSmartWindowControl.ShowHoImage(image); |
| | | //å
夿åç±»å夿ç¶ç±» |
| | | if (Subject.Record != null && Subject.Record is MsgRecord msgRecord) |
| | | { |
| | | recordImageHSmartWindowControl.DispObj(msgRecord.RecordObject_OK, true); |
| | | recordImageHSmartWindowControl.DispObj(msgRecord.RecordObject_NG, false); |
| | | |
| | | //å
夿åç±»å夿ç¶ç±» |
| | | if (Subject.Record != null && Subject.Record is MsgRecord msgRecord) |
| | | { |
| | | recordImageHSmartWindowControl.DispObj(msgRecord.RecordObject_OK, true); |
| | | recordImageHSmartWindowControl.DispObj(msgRecord.RecordObject_NG, false); |
| | | for (int i = 0; i < msgRecord.Msg.Length; i++) |
| | | recordImageHSmartWindowControl.ShowMsg(msgRecord.Msg[i] |
| | | , 1 == msgRecord.Result[i] ? true : false, msgRecord.Column[i], msgRecord.Row[i]); |
| | | } |
| | | else if (Subject.Record != null && Subject.Record is ObjectRecord objRecord) |
| | | { |
| | | recordImageHSmartWindowControl.DispObj(objRecord.RecordObject_OK, true); |
| | | recordImageHSmartWindowControl.DispObj(objRecord.RecordObject_NG, false); |
| | | } |
| | | |
| | | for (int i = 0; i < msgRecord.Msg.Length; i++) |
| | | recordImageHSmartWindowControl.ShowMsg(msgRecord.Msg[i] |
| | | , 1 == msgRecord.Result[i] ? true : false, msgRecord.Column[i], msgRecord.Row[i]); |
| | | } |
| | | else if (Subject.Record != null && Subject.Record is ObjectRecord objRecord) |
| | | { |
| | | recordImageHSmartWindowControl.DispObj(objRecord.RecordObject_OK, true); |
| | | recordImageHSmartWindowControl.DispObj(objRecord.RecordObject_NG, false); |
| | | } |
| | | } |
| | | |
| | | GC.Collect(); |
| | |
| | | HTuple hv_imageHeight = 0; |
| | | if (InputImage != null && InputImage is Mat) |
| | | { |
| | | TAlgorithm.Mat2HObject((Mat)InputImage, out HObject image); |
| | | HOperatorSet.GetImageSize(image, out hv_imageWidth, out hv_imageHeight); |
| | | } |
| | | switch (type) |
| | | { |
| | | case RoiType.Rectangle2: |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HRectangle2(hv_imageWidth.TupleReal() / 2, hv_imageHeight.TupleReal() / 2, 0 |
| | | , hv_imageWidth.TupleReal() / 4, hv_imageHeight.TupleReal() / 4); |
| | | break; |
| | | case RoiType.Circle: |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HCircle(hv_imageWidth.TupleReal() / 2, hv_imageHeight.TupleReal() / 2, hv_imageWidth.TupleReal() / 4); |
| | | break; |
| | | case RoiType.Segment: |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HSegment(0, 0, hv_imageWidth.TupleReal() / 4, hv_imageHeight.TupleReal() / 4); |
| | | break; |
| | | case RoiType.None: |
| | | default: |
| | | inputImageHSmartWindowControl.oRoi = null; |
| | | break; |
| | | using (HImage image = TAlgorithm.Mat2HObject((Mat)InputImage)) |
| | | { |
| | | HOperatorSet.GetImageSize(image, out hv_imageWidth, out hv_imageHeight); |
| | | switch (type) |
| | | { |
| | | case RoiType.Rectangle2: |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HRectangle2(hv_imageWidth.TupleReal() / 2, hv_imageHeight.TupleReal() / 2, 0 |
| | | , hv_imageWidth.TupleReal() / 4, hv_imageHeight.TupleReal() / 4); |
| | | break; |
| | | case RoiType.Circle: |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HCircle(hv_imageWidth.TupleReal() / 2, hv_imageHeight.TupleReal() / 2, hv_imageWidth.TupleReal() / 4); |
| | | break; |
| | | case RoiType.Segment: |
| | | inputImageHSmartWindowControl.oRoi |
| | | = new HSegment(0, 0, hv_imageWidth.TupleReal() / 4, hv_imageHeight.TupleReal() / 4); |
| | | break; |
| | | case RoiType.None: |
| | | default: |
| | | inputImageHSmartWindowControl.oRoi = null; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | if (InputImage != null && InputImage is Mat) |
| | | { |
| | | imgTabControl.SelectedTab = tabPageModelImage; |
| | | TAlgorithm.Mat2HObject((Mat)InputImage, out HObject hoDomainImage); |
| | | |
| | | HOperatorSet.GetImageSize(hoDomainImage, out HTuple hv_imageWidth, out HTuple hv_imageHeight); |
| | | createModelImageHSmartWindowControl.ShowHoImage((HObject)hoDomainImage); |
| | | createModelImageHSmartWindowControl.bAollowDraw = true; |
| | | createModelImageHSmartWindowControl.oRoi = new HRectangle2(hv_imageWidth.TupleReal() / 2, hv_imageHeight.TupleReal() / 2 |
| | | , 0, hv_imageWidth.TupleReal() / 4, hv_imageHeight.TupleReal() / 4); |
| | | using (HImage hoDomainImage = TAlgorithm.Mat2HObject((Mat)InputImage)) |
| | | { |
| | | HOperatorSet.GetImageSize(hoDomainImage, out HTuple hv_imageWidth, out HTuple hv_imageHeight); |
| | | createModelImageHSmartWindowControl.ShowHoImage((HObject)hoDomainImage); |
| | | createModelImageHSmartWindowControl.bAollowDraw = true; |
| | | createModelImageHSmartWindowControl.oRoi = new HRectangle2(hv_imageWidth.TupleReal() / 2, hv_imageHeight.TupleReal() / 2 |
| | | , 0, hv_imageWidth.TupleReal() / 4, hv_imageHeight.TupleReal() / 4); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | if (InputImage != null && InputImage is Mat) |
| | | { |
| | | double result = 0; |
| | | |
| | | if (Enum.TryParse(cmbModelType.Text, out ModelType modelType)) |
| | | { |
| | | string NumLevels = this.dtxtModelParam1.Text; |
| | |
| | | string Contrast = this.dtxtModelParam11.Text; |
| | | int MinContrast = Convert.ToInt16(this.dtxtModelParam12.Text); |
| | | HRectangle2 ROI = (HRectangle2)createModelImageHSmartWindowControl.oRoi; |
| | | |
| | | HOperatorSet.GenRectangle2(out HObject hRectangle, ROI.Row, ROI.Column, ROI.Phi, ROI.SemiLength1, ROI.SemiLength2); |
| | | TAlgorithm.Mat2HObject((Mat)InputImage, out HObject hoDomainImage); |
| | | HTuple hv_Channels = new HTuple(); |
| | | //夿æ¯å¦ä¸ºç°åº¦å¾ |
| | | using (HDevDisposeHelper dh = new HDevDisposeHelper()) |
| | | using (HRegion hRectangle = new HRegion()) |
| | | { |
| | | try |
| | | hRectangle.GenRectangle2(ROI.Row, ROI.Column, ROI.Phi, ROI.SemiLength1, ROI.SemiLength2); |
| | | using (HImage hoDomainImage = TAlgorithm.Mat2HObject((Mat)InputImage)) |
| | | { |
| | | HOperatorSet.CountChannels(hoDomainImage, out hv_Channels); |
| | | if (hv_Channels.TupleInt() != 1) |
| | | HOperatorSet.Rgb1ToGray(hoDomainImage, out hoDomainImage); |
| | | HTuple hv_Channels = new HTuple(); |
| | | //夿æ¯å¦ä¸ºç°åº¦å¾ |
| | | using (HDevDisposeHelper dh = new HDevDisposeHelper()) |
| | | { |
| | | try |
| | | { |
| | | //hv_Channels = hoDomainImage.CountChannels(); |
| | | //if (hv_Channels.TupleInt() != 1) |
| | | // HOperatorSet.Rgb1ToGray(hoDomainImage, out hoDomainImage); |
| | | |
| | | //转æ¢å忬¡æ£æ¥æ¯å¦ä¸ºç°åº¦å¾ |
| | | HOperatorSet.CountChannels(hoDomainImage, out hv_Channels); |
| | | if (hv_Channels.TupleInt() != 1) |
| | | HOperatorSet.Rgb1ToGray(hoDomainImage, out hoDomainImage); |
| | | ////转æ¢å忬¡æ£æ¥æ¯å¦ä¸ºç°åº¦å¾ |
| | | //HOperatorSet.CountChannels(hoDomainImage, out hv_Channels); |
| | | //if (hv_Channels.TupleInt() != 1) |
| | | // HOperatorSet.Rgb1ToGray(hoDomainImage, out hoDomainImage); |
| | | } |
| | | catch { } |
| | | } |
| | | HObject hoImageReduced = hoDomainImage.Rgb1ToGray().ReduceDomain(hRectangle); |
| | | HOperatorSet.CropDomain(hoImageReduced, out hoImageReduced); |
| | | TAlgorithm.HObject2Mat(hoImageReduced, out Mat hoModelImage); |
| | | bool bCreateModel = false; |
| | | |
| | | switch (modelType) |
| | | { |
| | | case ModelType.ç°åº¦å¹é
: |
| | | bCreateModel = ((FindModelTool)Subject).CreateModel |
| | | (hoModelImage, modelType, NumLevels |
| | | , AngleStart, AngleExtent, AngleStep |
| | | , ScaleRMin, ScaleRMax, "auto" |
| | | , ScaleCMin, ScaleCMax, "auto" |
| | | , Optimization, Metric, Contrast, MinContrast); |
| | | break; |
| | | default: |
| | | bCreateModel = ((FindModelTool)Subject).CreateModel |
| | | (hoModelImage, modelType, NumLevels |
| | | , AngleStart, AngleExtent, AngleStep |
| | | , ScaleRMin, ScaleRMax, "auto" |
| | | , ScaleCMin, ScaleCMax, "auto" |
| | | , Optimization, Metric, Contrast, MinContrast); |
| | | break; |
| | | } |
| | | |
| | | if (bCreateModel) |
| | | { |
| | | using (HObject ho_ModelContours = new HObject()) |
| | | { |
| | | //switch (((FindModelTool)Subject).ModelID.Type) |
| | | //{ |
| | | // case ModelType.å±é¨å形模æ¿: |
| | | // HOperatorSet.GetDeformableModelContours(out ho_ModelContours, ((HFindModelTool)Subject).ModelID.hvModel, 1); |
| | | // break; |
| | | // case ModelType.ååå¼å½¢æ¨¡æ¿: |
| | | // default: |
| | | // HOperatorSet.GetShapeModelContours(out ho_ModelContours, ((HFindModelTool)Subject).ModelID.hvModel, 1); |
| | | // break; |
| | | //} |
| | | //HOperatorSet.GetImageSize(((HFindModelTool)Subject).ModelID.hoImage, out HTuple hv_Width, out HTuple hv_Height); |
| | | //HOperatorSet.VectorAngleToRigid(-hv_Height / 2, -hv_Width / 2, 0, 0, 0, 0, out HTuple hv_HomMat2D); |
| | | //HOperatorSet.AffineTransContourXld(ho_ModelContours, out ho_ModelContours, hv_HomMat2D); |
| | | |
| | | //建模æå导èªå°å页 |
| | | parasTabControl.SelectedTab = tabPageRunParas; |
| | | //modelImageHSmartWindowControl.ShowHoImage(((HFindModelTool)Subject).ModelID.hoImage); |
| | | using (HImage modelImage = TAlgorithm.Mat2HObject(((FindModelTool)Subject).ModelID.hoImage)) |
| | | { |
| | | modelImageHSmartWindowControl.ShowHoImage(modelImage); |
| | | modelImageHSmartWindowControl.DispObj(ho_ModelContours, false); |
| | | modelImageHSmartWindowControl.ShowMsg("åå»ºæ¨¡æ¿æå", true); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch { } |
| | | } |
| | | HOperatorSet.ReduceDomain(hoDomainImage, hRectangle, out HObject hoImageReduced); |
| | | HOperatorSet.CropDomain(hoImageReduced, out hoImageReduced); |
| | | TAlgorithm.HObject2Mat(hoImageReduced, out Mat hoModelImage); |
| | | bool bCreateModel = false; |
| | | |
| | | switch (modelType) |
| | | { |
| | | case ModelType.ç°åº¦å¹é
: |
| | | bCreateModel = ((FindModelTool)Subject).CreateModel |
| | | (hoModelImage, modelType, NumLevels |
| | | , AngleStart, AngleExtent, AngleStep |
| | | , ScaleRMin, ScaleRMax, "auto" |
| | | , ScaleCMin, ScaleCMax, "auto" |
| | | , Optimization, Metric, Contrast, MinContrast); |
| | | break; |
| | | default: |
| | | bCreateModel = ((FindModelTool)Subject).CreateModel |
| | | (hoModelImage, modelType, NumLevels |
| | | , AngleStart, AngleExtent, AngleStep |
| | | , ScaleRMin, ScaleRMax, "auto" |
| | | , ScaleCMin, ScaleCMax, "auto" |
| | | , Optimization, Metric, Contrast, MinContrast); |
| | | break; |
| | | } |
| | | |
| | | if (bCreateModel) |
| | | { |
| | | HObject ho_ModelContours = new HObject(); |
| | | //switch (((FindModelTool)Subject).ModelID.Type) |
| | | //{ |
| | | // case ModelType.å±é¨å形模æ¿: |
| | | // HOperatorSet.GetDeformableModelContours(out ho_ModelContours, ((HFindModelTool)Subject).ModelID.hvModel, 1); |
| | | // break; |
| | | // case ModelType.ååå¼å½¢æ¨¡æ¿: |
| | | // default: |
| | | // HOperatorSet.GetShapeModelContours(out ho_ModelContours, ((HFindModelTool)Subject).ModelID.hvModel, 1); |
| | | // break; |
| | | //} |
| | | //HOperatorSet.GetImageSize(((HFindModelTool)Subject).ModelID.hoImage, out HTuple hv_Width, out HTuple hv_Height); |
| | | //HOperatorSet.VectorAngleToRigid(-hv_Height / 2, -hv_Width / 2, 0, 0, 0, 0, out HTuple hv_HomMat2D); |
| | | //HOperatorSet.AffineTransContourXld(ho_ModelContours, out ho_ModelContours, hv_HomMat2D); |
| | | |
| | | //建模æå导èªå°å页 |
| | | parasTabControl.SelectedTab = tabPageRunParas; |
| | | //modelImageHSmartWindowControl.ShowHoImage(((HFindModelTool)Subject).ModelID.hoImage); |
| | | TAlgorithm.Mat2HObject(((FindModelTool)Subject).ModelID.hoImage, out HObject modelImage); |
| | | modelImageHSmartWindowControl.ShowHoImage(modelImage); |
| | | modelImageHSmartWindowControl.DispObj(ho_ModelContours, false); |
| | | modelImageHSmartWindowControl.ShowMsg("åå»ºæ¨¡æ¿æå", true); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | if (ModelID != null && ModelID.Width > 0) |
| | | { |
| | | HOperatorSet.GenEmptyObj(out HObject ho_ModelContours); |
| | | //switch (ModelID.Type) |
| | | //{ |
| | | // case ModelType.ååå¼å½¢æ¨¡æ¿: |
| | | // HOperatorSet.GetDeformableModelContours(out ho_ModelContours, ModelID.hvModel, 1); |
| | | // break; |
| | | // default: |
| | | // HOperatorSet.GetShapeModelContours(out ho_ModelContours, ModelID.hvModel, 1); |
| | | // break; |
| | | //} |
| | | //HOperatorSet.GenEmptyObj(out HObject ho_ModelContours); |
| | | using (HRegion ho_ModelContours = new HRegion()) |
| | | { |
| | | //switch (ModelID.Type) |
| | | //{ |
| | | // case ModelType.ååå¼å½¢æ¨¡æ¿: |
| | | // HOperatorSet.GetDeformableModelContours(out ho_ModelContours, ModelID.hvModel, 1); |
| | | // break; |
| | | // default: |
| | | // HOperatorSet.GetShapeModelContours(out ho_ModelContours, ModelID.hvModel, 1); |
| | | // break; |
| | | //} |
| | | |
| | | //HOperatorSet.GetImageSize(ModelID.hoImage, out HTuple hv_Width, out HTuple hv_Height); |
| | | //HOperatorSet.VectorAngleToRigid(-hv_Height / 2, -hv_Width / 2, 0, 0, 0, 0, out HTuple hv_HomMat2D); |
| | | //HOperatorSet.AffineTransContourXld(ho_ModelContours, out ho_ModelContours, hv_HomMat2D); |
| | | //HOperatorSet.GetImageSize(ModelID.hoImage, out HTuple hv_Width, out HTuple hv_Height); |
| | | //HOperatorSet.VectorAngleToRigid(-hv_Height / 2, -hv_Width / 2, 0, 0, 0, 0, out HTuple hv_HomMat2D); |
| | | //HOperatorSet.AffineTransContourXld(ho_ModelContours, out ho_ModelContours, hv_HomMat2D); |
| | | |
| | | modelImageHSmartWindowControl.ClearObj(); |
| | | TAlgorithm.Mat2HObject(ModelID.hoImage, out HObject hoImage); |
| | | //modelImageHSmartWindowControl.ShowHoImage(ModelID.hoImage); |
| | | modelImageHSmartWindowControl.ShowHoImage(hoImage); |
| | | modelImageHSmartWindowControl.DispObj(ho_ModelContours, false); |
| | | modelImageHSmartWindowControl.ShowMsg("åå»ºæ¨¡æ¿æå", true); |
| | | modelImageHSmartWindowControl.ClearObj(); |
| | | using (HImage hoImage = TAlgorithm.Mat2HObject(ModelID.hoImage)) |
| | | { |
| | | //modelImageHSmartWindowControl.ShowHoImage(ModelID.hoImage); |
| | | modelImageHSmartWindowControl.ShowHoImage(hoImage); |
| | | modelImageHSmartWindowControl.DispObj(ho_ModelContours, false); |
| | | modelImageHSmartWindowControl.ShowMsg("åå»ºæ¨¡æ¿æå", true); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch { } |
| | |
| | | btnSaveImage.Dock = DockStyle.Fill; |
| | | btnSaveImage.ForeColor = SystemColors.Desktop; |
| | | btnSaveImage.Location = new Point(266, 2); |
| | | btnSaveImage.Margin = new Padding(2, 2, 2, 2); |
| | | btnSaveImage.Margin = new Padding(2); |
| | | btnSaveImage.Name = "btnSaveImage"; |
| | | btnSaveImage.Size = new Size(84, 30); |
| | | btnSaveImage.TabIndex = 8; |
| | |
| | | controlBox1.EnableMaximizeButton = false; |
| | | controlBox1.EnableMinimizeButton = false; |
| | | controlBox1.ForeColor = Color.FromArgb(155, 155, 155); |
| | | controlBox1.Location = new Point(807, 15); |
| | | controlBox1.Location = new Point(785, 18); |
| | | controlBox1.MaximizeHoverColor = Color.FromArgb(74, 74, 74); |
| | | controlBox1.MinimizeHoverColor = Color.FromArgb(63, 63, 65); |
| | | controlBox1.Name = "controlBox1"; |
| | |
| | | panel_2DCameraForm.EdgeColor = Color.FromArgb(32, 41, 50); |
| | | panel_2DCameraForm.Location = new Point(10, 70); |
| | | panel_2DCameraForm.Name = "panel_2DCameraForm"; |
| | | panel_2DCameraForm.Padding = new Padding(5, 5, 5, 5); |
| | | panel_2DCameraForm.Padding = new Padding(5); |
| | | panel_2DCameraForm.Size = new Size(865, 601); |
| | | panel_2DCameraForm.SmoothingType = System.Drawing.Drawing2D.SmoothingMode.HighQuality; |
| | | panel_2DCameraForm.TabIndex = 20; |
| | |
| | | private void btnEdit_Click(object sender, EventArgs e) |
| | | { |
| | | if (camera == null) |
| | | { |
| | | return; |
| | | |
| | | } |
| | | using (Form editForm = new Form()) |
| | | { |
| | | editForm.Text = "é«çº§åæ°è®¾ç½® - " + camera.SN; |
| | |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Serialization; |
| | | using OpenCvSharp; |
| | | using OpenCvSharp.Extensions; |
| | | using System.Collections.Concurrent; |
| | | using System.Diagnostics; |
| | | using System.Text; |
| | |
| | | |
| | | Mat src = Cv2.ImRead(SN); |
| | | if (src != null && !src.Empty()) |
| | | OutputImage = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(src); |
| | | OutputImage = src.ToBitmap(); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | 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}"); |
| | |
| | | } while (times > 0 && isRegrab); |
| | | |
| | | if (isUpParams) |
| | | { |
| | | Camera.SetCamConfig(oriConfig); |
| | | |
| | | } |
| | | OutputImage = bitmap; |
| | | } |
| | | |
| | |
| | | { |
| | | 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; |
| | | } |
| | | |
| | |
| | | if (OutputImage != null) |
| | | { |
| | | if (OutputImage is Bitmap) |
| | | { |
| | | obj.OutputImage = ((Bitmap)OutputImage).Clone(); |
| | | } |
| | | } |
| | | |
| | | return obj; |
| | |
| | | /// <summary> |
| | | /// å
许è¿è¡æ¶é´ |
| | | /// </summary> |
| | | public double MaxTimeOut = 2000; |
| | | public double MaxTimeOut = 200000000000; |
| | | |
| | | /// <summary> |
| | | /// å·¥å
·åç§° |
| | |
| | | </EmbeddedResource> |
| | | </ItemGroup> |
| | | |
| | | <ItemGroup> |
| | | <None Update="ref\CLIDelegate.dll"> |
| | | <CopyToOutputDirectory>Always</CopyToOutputDirectory> |
| | | </None> |
| | | <None Update="ref\halcondotnet.dll"> |
| | | <CopyToOutputDirectory>Always</CopyToOutputDirectory> |
| | | </None> |
| | | <None Update="ref\MVSDKmd.dll"> |
| | | <CopyToOutputDirectory>Always</CopyToOutputDirectory> |
| | | </None> |
| | | <None Update="ref\MVSDK_Net.dll"> |
| | | <CopyToOutputDirectory>Always</CopyToOutputDirectory> |
| | | </None> |
| | | <None Update="ref\MVSDK_Net.XML"> |
| | | <CopyToOutputDirectory>Always</CopyToOutputDirectory> |
| | | </None> |
| | | <None Update="ref\PHM6000.dll"> |
| | | <CopyToOutputDirectory>Always</CopyToOutputDirectory> |
| | | </None> |
| | | <None Update="ref\PHM6000API.dll"> |
| | | <CopyToOutputDirectory>Always</CopyToOutputDirectory> |
| | | </None> |
| | | <None Update="ref\PHM6000API.lib"> |
| | | <CopyToOutputDirectory>Always</CopyToOutputDirectory> |
| | | </None> |
| | | <None Update="ref\Pilot2D.dll"> |
| | | <CopyToOutputDirectory>Always</CopyToOutputDirectory> |
| | | </None> |
| | | <None Update="ref\PointCloud3D.dll"> |
| | | <CopyToOutputDirectory>Always</CopyToOutputDirectory> |
| | | </None> |
| | | <None Update="ref\ThridLibray.dll"> |
| | | <CopyToOutputDirectory>Always</CopyToOutputDirectory> |
| | | </None> |
| | | </ItemGroup> |
| | | |
| | | </Project> |