change save directory & modify position offset computation

This commit is contained in:
2025-11-03 13:20:30 +08:00
parent 95573c98c6
commit 87fe8027b5
4 changed files with 4696 additions and 4794 deletions

View File

@@ -1,7 +1,7 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 18 # Visual Studio Version 18
VisualStudioVersion = 18.0.11123.170 d18.0 VisualStudioVersion = 18.0.11123.170
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TetraParkOCR", "TetraParkOCR\TetraParkOCR.csproj", "{533800AA-D6A6-4EF7-825F-AA143B1EE901}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TetraParkOCR", "TetraParkOCR\TetraParkOCR.csproj", "{533800AA-D6A6-4EF7-825F-AA143B1EE901}"
EndProject EndProject

View File

@@ -108,12 +108,6 @@
this.panel_auto = new System.Windows.Forms.Panel(); this.panel_auto = new System.Windows.Forms.Panel();
this.panel_locationDisplay = new System.Windows.Forms.Panel(); this.panel_locationDisplay = new System.Windows.Forms.Panel();
this.toolTip = new System.Windows.Forms.ToolTip(this.components); this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.panel1 = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.tableLayoutPanel_productInformtion.SuspendLayout(); this.tableLayoutPanel_productInformtion.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.Location_Display)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.Location_Display)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.Ocr_picBox)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.Ocr_picBox)).BeginInit();
@@ -128,7 +122,6 @@
this.panel_pixshow.SuspendLayout(); this.panel_pixshow.SuspendLayout();
this.panel_auto.SuspendLayout(); this.panel_auto.SuspendLayout();
this.panel_locationDisplay.SuspendLayout(); this.panel_locationDisplay.SuspendLayout();
this.panel1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// btn_OrderNum // btn_OrderNum
@@ -1079,7 +1072,6 @@
// //
// panel_auto // panel_auto
// //
this.panel_auto.Controls.Add(this.panel1);
this.panel_auto.Controls.Add(this.panel_OrderInformation); this.panel_auto.Controls.Add(this.panel_OrderInformation);
this.panel_auto.Controls.Add(this.panel_AutoRun); this.panel_auto.Controls.Add(this.panel_AutoRun);
this.panel_auto.Controls.Add(this.panel_Manual); this.panel_auto.Controls.Add(this.panel_Manual);
@@ -1100,82 +1092,6 @@
this.panel_locationDisplay.Size = new System.Drawing.Size(478, 388); this.panel_locationDisplay.Size = new System.Drawing.Size(478, 388);
this.panel_locationDisplay.TabIndex = 0; this.panel_locationDisplay.TabIndex = 0;
// //
// panel1
//
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel1.Controls.Add(this.comboBox1);
this.panel1.Controls.Add(this.button3);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.button1);
this.panel1.Controls.Add(this.button2);
this.panel1.Location = new System.Drawing.Point(1, 649);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(315, 163);
this.panel1.TabIndex = 31;
this.panel1.Visible = false;
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label1.BackColor = System.Drawing.Color.DeepSkyBlue;
this.label1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(-3, -1);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(317, 35);
this.label1.TabIndex = 26;
this.label1.Text = "单步调试操作";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.button1.BackColor = System.Drawing.Color.DodgerBlue;
this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button1.Location = new System.Drawing.Point(79, 81);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(154, 38);
this.button1.TabIndex = 23;
this.button1.Text = "移动坐标";
this.button1.UseVisualStyleBackColor = false;
//
// button2
//
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.button2.BackColor = System.Drawing.Color.DodgerBlue;
this.button2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button2.Location = new System.Drawing.Point(79, 37);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(154, 38);
this.button2.TabIndex = 25;
this.button2.Text = "获取定位坐标";
this.button2.UseVisualStyleBackColor = false;
//
// button3
//
this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.button3.BackColor = System.Drawing.Color.DodgerBlue;
this.button3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button3.Location = new System.Drawing.Point(79, 121);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(154, 38);
this.button3.TabIndex = 27;
this.button3.Text = "结束操作";
this.button3.UseVisualStyleBackColor = false;
//
// comboBox1
//
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(239, 93);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(64, 20);
this.comboBox1.TabIndex = 28;
//
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -1208,7 +1124,6 @@
this.panel_pixshow.ResumeLayout(false); this.panel_pixshow.ResumeLayout(false);
this.panel_auto.ResumeLayout(false); this.panel_auto.ResumeLayout(false);
this.panel_locationDisplay.ResumeLayout(false); this.panel_locationDisplay.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@@ -1293,12 +1208,6 @@
private System.Windows.Forms.Button btn_StarDet_manual; private System.Windows.Forms.Button btn_StarDet_manual;
private System.Windows.Forms.ToolTip toolTip; private System.Windows.Forms.ToolTip toolTip;
private System.Windows.Forms.ListView list_Log; private System.Windows.Forms.ListView list_Log;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.ComboBox comboBox1;
} }
} }

View File

@@ -95,8 +95,8 @@ namespace TetraPackOCR
/// <summary> /// <summary>
/// 存图路径 /// 存图路径
/// </summary> /// </summary>
string SaveImageFileOCR = AppDomain.CurrentDomain.BaseDirectory + "SaveImage\\OCR";//ocr存图 string SaveImageFileOCR = System.IO.Path.GetPathRoot(Application.ExecutablePath) + "SaveImage\\OCR";//ocr存图
string SaveImageFileDET = AppDomain.CurrentDomain.BaseDirectory + "SaveImage\\Det";//ocr存图 string SaveImageFileDET = System.IO.Path.GetPathRoot(Application.ExecutablePath) + "SaveImage\\Det";//ocr存图
private CogJobManager myJobManager1; private CogJobManager myJobManager1;
private CogJob myJob1; private CogJob myJob1;
@@ -310,7 +310,7 @@ namespace TetraPackOCR
using (IFloatParameter p = m_dev_cam0.ParameterCollection[ParametrizeNameSet.ExposureTime]) using (IFloatParameter p = m_dev_cam0.ParameterCollection[ParametrizeNameSet.ExposureTime])
{ {
p.SetValue(80000); p.SetValue(800000);
} }
// 设置增益 // 设置增益
@@ -433,7 +433,7 @@ namespace TetraPackOCR
using (IFloatParameter p = m_dev_cam1.ParameterCollection[ParametrizeNameSet.ExposureTime]) using (IFloatParameter p = m_dev_cam1.ParameterCollection[ParametrizeNameSet.ExposureTime])
{ {
p.SetValue(80000); p.SetValue(30000);
} }
// 设置增益 // 设置增益
@@ -635,7 +635,6 @@ namespace TetraPackOCR
this.panel_Manual.Visible = true; this.panel_Manual.Visible = true;
this.btn_StarDet_manual.Enabled = false; this.btn_StarDet_manual.Enabled = false;
this.ttls_PCLStatusShow.Visible = false; this.ttls_PCLStatusShow.Visible = false;
panel1.Visible = true;
} }
else if (!check_Autorun.Checked) else if (!check_Autorun.Checked)
{ {
@@ -645,7 +644,6 @@ namespace TetraPackOCR
this.panel_Manual.Visible = false; this.panel_Manual.Visible = false;
this.btn_StarDet_manual.Enabled = true; this.btn_StarDet_manual.Enabled = true;
this.ttls_PCLStatusShow.Visible = true; this.ttls_PCLStatusShow.Visible = true;
panel1.Visible = false;
} }
} }
@@ -1479,7 +1477,7 @@ namespace TetraPackOCR
fs.Close(); fs.Close();
log.Info("OCR存图已完成"); log.Info("OCR存图已完成");
CutPicture(SaveImageFileOCR + '\\' + strtimef + '\\' + strTime + ".bmp", 200, 1400, 5052, 1600); CutPicture(SaveImageFileOCR + '\\' + strtimef + '\\' + strTime + ".bmp", 600, 1800, 3200, 1600);
//List<PointD> temps = new List<PointD>(); //List<PointD> temps = new List<PointD>();
GetOCRImage getOCRImage = new GetOCRImage(); GetOCRImage getOCRImage = new GetOCRImage();
@@ -1937,6 +1935,8 @@ namespace TetraPackOCR
log.Info("PC接收PLC数据数据内容" + mMatchingStr); log.Info("PC接收PLC数据数据内容" + mMatchingStr);
if (NumberOfLanes + 1 == mMatchingStr) if (NumberOfLanes + 1 == mMatchingStr)
{ {
if (ocrAcc.Count == 0)
return;
if (ocrAcc.Min() < 0.95) if (ocrAcc.Min() < 0.95)
{ {
MessageBox.Show("当前检测中出现严重错误请注意!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("当前检测中出现严重错误请注意!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
@@ -2165,18 +2165,18 @@ namespace TetraPackOCR
if (item == 0) if (item == 0)
{ {
ocrx = xx - ((float)DistX) * ((float)Math.Cos((rr * Math.PI) / 180)); ocrx = xx - ((float)DistX) * ((float)Math.Cos((rr * Math.PI) / 180)) - ((float)DistY) * ((float)Math.Sin((rr * Math.PI) / 180));
l.Add(ocrx); l.Add(ocrx);
ocry = yy - ((float)DistY) * ((float)Math.Sin((rr * Math.PI) / 180)); ocry = yy + ((float)DistY) * ((float)Math.Cos((rr * Math.PI) / 180)) - ((float)DistX) * ((float)Math.Sin((rr * Math.PI) / 180));
l.Add(ocry); l.Add(ocry);
ocrxx.Add(ocrx); ocrxx.Add(ocrx);
ocryy.Add(ocry); ocryy.Add(ocry);
} }
else else
{ {
ocrx = ocrx + ((float)width * ((float)Math.Cos((rr * Math.PI) / 180))); ocrx = ocrx + ((float)width * ((float)Math.Cos((rr * Math.PI) / 180))) + ((float)Gradient * ((float)Math.Sin((rr * Math.PI) / 180)));
l.Add(ocrx); l.Add(ocrx);
ocry = ocry - ((float)Gradient * ((float)Math.Cos((rr * Math.PI) / 180))); ocry = ocry - ((float)Gradient * ((float)Math.Cos((rr * Math.PI) / 180))) + ((float)width * ((float)Math.Sin((rr * Math.PI) / 180)));
l.Add(ocry); l.Add(ocry);
ocrxx.Add(ocrx); ocrxx.Add(ocrx);
ocryy.Add(ocry); ocryy.Add(ocry);

File diff suppressed because it is too large Load Diff