Update parameter
This commit is contained in:
@@ -33,7 +33,7 @@ namespace WaferAlignment
|
||||
set { _isStarted = value; }
|
||||
}
|
||||
public event Action<Bitmap> OutputImageEvent;
|
||||
private float expo = 8;
|
||||
private float expo = 12;
|
||||
private uint imgHeight = 4000;
|
||||
private MyCamera _dev;
|
||||
private CancellationTokenSource _startAcqToken;
|
||||
|
||||
80
WaferAlignment/Form1.Designer.cs
generated
80
WaferAlignment/Form1.Designer.cs
generated
@@ -32,6 +32,10 @@
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.cogRecordDisplay1 = new Cognex.VisionPro.CogRecordDisplay();
|
||||
this.textBox2 = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.textBox3 = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.lbl_Time = new System.Windows.Forms.Label();
|
||||
this.txt_Time = new System.Windows.Forms.TextBox();
|
||||
this.lbl_Times = new System.Windows.Forms.Label();
|
||||
@@ -68,10 +72,6 @@
|
||||
this.nud_SizeX = new System.Windows.Forms.NumericUpDown();
|
||||
this.btn_Action = new System.Windows.Forms.Button();
|
||||
this.btn_ToZero = new System.Windows.Forms.Button();
|
||||
this.textBox2 = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.textBox3 = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
@@ -155,6 +155,42 @@
|
||||
this.cogRecordDisplay1.Size = new System.Drawing.Size(885, 558);
|
||||
this.cogRecordDisplay1.TabIndex = 0;
|
||||
//
|
||||
// textBox2
|
||||
//
|
||||
this.textBox2.Location = new System.Drawing.Point(534, 22);
|
||||
this.textBox2.Name = "textBox2";
|
||||
this.textBox2.Size = new System.Drawing.Size(55, 21);
|
||||
this.textBox2.TabIndex = 33;
|
||||
this.textBox2.Text = "128";
|
||||
this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(532, 7);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(53, 12);
|
||||
this.label1.TabIndex = 34;
|
||||
this.label1.Text = "相机计数";
|
||||
//
|
||||
// textBox3
|
||||
//
|
||||
this.textBox3.Location = new System.Drawing.Point(595, 22);
|
||||
this.textBox3.Name = "textBox3";
|
||||
this.textBox3.Size = new System.Drawing.Size(55, 21);
|
||||
this.textBox3.TabIndex = 35;
|
||||
this.textBox3.Text = "4096";
|
||||
this.textBox3.TextChanged += new System.EventHandler(this.textBox3_TextChanged);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(593, 7);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(41, 12);
|
||||
this.label2.TabIndex = 36;
|
||||
this.label2.Text = "总计数";
|
||||
//
|
||||
// lbl_Time
|
||||
//
|
||||
this.lbl_Time.AutoSize = true;
|
||||
@@ -507,42 +543,6 @@
|
||||
this.btn_ToZero.UseVisualStyleBackColor = true;
|
||||
this.btn_ToZero.Click += new System.EventHandler(this.btn_ToZero_Click);
|
||||
//
|
||||
// textBox2
|
||||
//
|
||||
this.textBox2.Location = new System.Drawing.Point(534, 22);
|
||||
this.textBox2.Name = "textBox2";
|
||||
this.textBox2.Size = new System.Drawing.Size(55, 21);
|
||||
this.textBox2.TabIndex = 33;
|
||||
this.textBox2.Text = "82";
|
||||
this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(532, 7);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(53, 12);
|
||||
this.label1.TabIndex = 34;
|
||||
this.label1.Text = "相机计数";
|
||||
//
|
||||
// textBox3
|
||||
//
|
||||
this.textBox3.Location = new System.Drawing.Point(595, 22);
|
||||
this.textBox3.Name = "textBox3";
|
||||
this.textBox3.Size = new System.Drawing.Size(55, 21);
|
||||
this.textBox3.TabIndex = 35;
|
||||
this.textBox3.Text = "4096";
|
||||
this.textBox3.TextChanged += new System.EventHandler(this.textBox3_TextChanged);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(593, 7);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(41, 12);
|
||||
this.label2.TabIndex = 36;
|
||||
this.label2.Text = "总计数";
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
|
||||
@@ -59,7 +59,6 @@ namespace WaferAlignment
|
||||
FitCircleToolBlock FitCircleMachineToolBlock;
|
||||
TranslateCirclePoint translateCirclePoint;
|
||||
CogGraphicCollection m_graphics;
|
||||
CogGraphicCollection m_graphics2;
|
||||
|
||||
//XML文件读取与写入
|
||||
ConfigStore _ConfigStore = new ConfigStore();
|
||||
@@ -153,7 +152,6 @@ namespace WaferAlignment
|
||||
FitCircleMachineToolBlock.OnToolReady += FitCircleMachineToolBlock_OnToolReady;
|
||||
FitCircleMachineToolBlock.Initialize("vpp\\FitCircleM.vpp");
|
||||
translateCirclePoint = new TranslateCirclePoint();
|
||||
m_graphics2 = new CogGraphicCollection();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -190,17 +188,17 @@ namespace WaferAlignment
|
||||
deviationX = Math.Round((x - translateCirclePoint.GetRotateX()), 3);
|
||||
deviationY = Math.Round((y - translateCirclePoint.GetRotateY()), 3);
|
||||
|
||||
AddPointMarker(m_graphics2, x, y);
|
||||
AddPointMarker(m_graphics2, translateCirclePoint.GetRotateX(), translateCirclePoint.GetRotateY(), CogColorConstants.Red);
|
||||
AddPointMarker(m_graphics, x, y);
|
||||
AddPointMarker(m_graphics, translateCirclePoint.GetRotateX(), translateCirclePoint.GetRotateY(), CogColorConstants.Red);
|
||||
|
||||
PointInfo nPoint = translateCirclePoint.GetNashPoint();
|
||||
if (nPoint != null)
|
||||
{
|
||||
AddPointMarker(m_graphics2, nPoint.X, nPoint.Y, CogColorConstants.Yellow);
|
||||
AddLineMarker(m_graphics2, x, y, x, y - r);
|
||||
AddLineMarker(m_graphics2, x, y, nPoint.X, nPoint.Y, CogColorConstants.Yellow);
|
||||
AddPointMarker(m_graphics, nPoint.X, nPoint.Y, CogColorConstants.Yellow);
|
||||
AddLineMarker(m_graphics, x, y, x, y - r);
|
||||
AddLineMarker(m_graphics, x, y, nPoint.X, nPoint.Y, CogColorConstants.Yellow);
|
||||
angle = GetCounterClockwiseAngle360(x, y, x, y - r, nPoint.X, nPoint.Y);
|
||||
AddLabelMarker(m_graphics2, angle.ToString(), x, y, CogColorConstants.Yellow);
|
||||
AddLabelMarker(m_graphics, angle.ToString(), x, y, CogColorConstants.Yellow);
|
||||
LogHelper.LogInfo($"nash degree:{angle}");
|
||||
}
|
||||
|
||||
@@ -208,7 +206,6 @@ namespace WaferAlignment
|
||||
LogHelper.LogInfo($"DiffX:{deviationX}, DiffY:{deviationY}, RMS:{rms}{Environment.NewLine}");
|
||||
ImageDisplay(FitCircleMachineToolBlock.FitCircleImage);
|
||||
ImageDisplay(m_graphics);
|
||||
ImageDisplay(m_graphics2);
|
||||
ImageDisplayFit();
|
||||
}
|
||||
private void AddPointMarker(CogGraphicCollection graphicCollection, double x, double y, CogColorConstants color = CogColorConstants.Green)
|
||||
@@ -290,10 +287,10 @@ namespace WaferAlignment
|
||||
/// <param name="e"></param>
|
||||
private void _tcp_DataReceived(object sender, DataReceivedEventArgs e)
|
||||
{
|
||||
if (this.InvokeRequired)
|
||||
if (InvokeRequired)
|
||||
{
|
||||
// 如果当前线程不是UI线程,则使用Invoke在UI线程上执行
|
||||
this.Invoke(new Action<object,DataReceivedEventArgs>(_tcp_DataReceived), sender, e);
|
||||
Invoke(new Action<object,DataReceivedEventArgs>(_tcp_DataReceived), sender, e);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -388,12 +385,12 @@ namespace WaferAlignment
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
this.splitContainer1.Invoke(new Action(() => this.splitContainer1.Panel2.Enabled = false));
|
||||
splitContainer1.Invoke(new Action(() => splitContainer1.Panel2.Enabled = false));
|
||||
string str = "";
|
||||
str = ToZero();
|
||||
MessageBox.Show(str);
|
||||
|
||||
this.splitContainer1.Invoke(new Action(() => this.splitContainer1.Panel2.Enabled = true));
|
||||
splitContainer1.Invoke(new Action(() => splitContainer1.Panel2.Enabled = true));
|
||||
});
|
||||
}
|
||||
public string ToZero()
|
||||
@@ -437,12 +434,12 @@ namespace WaferAlignment
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
this.splitContainer1.Invoke(new Action(() => this.splitContainer1.Panel2.Enabled = false));
|
||||
splitContainer1.Invoke(new Action(() => splitContainer1.Panel2.Enabled = false));
|
||||
string str = "";
|
||||
str = ToAction();
|
||||
MessageBox.Show(str);
|
||||
|
||||
this.splitContainer1.Invoke(new Action(() => this.splitContainer1.Panel2.Enabled = true));
|
||||
splitContainer1.Invoke(new Action(() => splitContainer1.Panel2.Enabled = true));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -505,12 +502,12 @@ namespace WaferAlignment
|
||||
ClearDisplay();
|
||||
Task.Run(() =>
|
||||
{
|
||||
this.splitContainer1.Invoke(new Action(() => this.splitContainer1.Panel2.Enabled = false));
|
||||
splitContainer1.Invoke(new Action(() => splitContainer1.Panel2.Enabled = false));
|
||||
string str = "";
|
||||
str = RunTest();
|
||||
MessageBox.Show(str);
|
||||
|
||||
this.splitContainer1.Invoke(new Action(() => this.splitContainer1.Panel2.Enabled = true));
|
||||
splitContainer1.Invoke(new Action(() => splitContainer1.Panel2.Enabled = true));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -759,7 +756,7 @@ namespace WaferAlignment
|
||||
|
||||
LogHelper.LogInfo("拟合机械坐标系下的圆中心:\n");
|
||||
m_graphics = new CogGraphicCollection();
|
||||
m_graphics2 = new CogGraphicCollection();
|
||||
m_graphics = new CogGraphicCollection();
|
||||
foreach (PointInfo pointInfo in points)
|
||||
{
|
||||
AddPointMarker(m_graphics, pointInfo.X, pointInfo.Y);
|
||||
@@ -779,9 +776,9 @@ namespace WaferAlignment
|
||||
|
||||
private void ResultDisplay(double Times,double Time, string X, string Y, string R, string RMS, double dX, double dY, double dR)
|
||||
{
|
||||
if (this.InvokeRequired)
|
||||
if (InvokeRequired)
|
||||
{
|
||||
this.BeginInvoke(new Action(() => ResultDisplay(Times,Time,X, Y, R, RMS, dX, dY, dR)));
|
||||
BeginInvoke(new Action(() => ResultDisplay(Times,Time,X, Y, R, RMS, dX, dY, dR)));
|
||||
return;
|
||||
}
|
||||
txt_Times.Text = Times.ToString();
|
||||
@@ -797,44 +794,33 @@ namespace WaferAlignment
|
||||
}
|
||||
private void ClearDisplay()
|
||||
{
|
||||
if (this.InvokeRequired)
|
||||
if (InvokeRequired)
|
||||
{
|
||||
this.BeginInvoke(new Action(() => ClearDisplay()));
|
||||
BeginInvoke(new Action(() => ClearDisplay()));
|
||||
return;
|
||||
}
|
||||
this.cogRecordDisplay1.InteractiveGraphics.Clear();
|
||||
this.cogRecordDisplay1.StaticGraphics.Clear();
|
||||
this.cogRecordDisplay1.Image = null;
|
||||
cogRecordDisplay1.InteractiveGraphics.Clear();
|
||||
cogRecordDisplay1.StaticGraphics.Clear();
|
||||
cogRecordDisplay1.Image = null;
|
||||
}
|
||||
|
||||
private void ImageDisplay(CogImage8Grey img, CogGraphicCollection graphics)
|
||||
{
|
||||
if (this.InvokeRequired)
|
||||
{
|
||||
this.BeginInvoke(new Action(() => ImageDisplay(img, graphics)));
|
||||
return;
|
||||
}
|
||||
this.cogRecordDisplay1.Image = img;
|
||||
this.cogRecordDisplay1.StaticGraphics.AddList(graphics, "");
|
||||
this.cogRecordDisplay1.Fit(true);
|
||||
}
|
||||
private void ImageDisplay(CogGraphicCollection graphics)
|
||||
{
|
||||
if (this.InvokeRequired)
|
||||
if (InvokeRequired)
|
||||
{
|
||||
this.BeginInvoke(new Action(() => ImageDisplay(graphics)));
|
||||
BeginInvoke(new Action(() => ImageDisplay(graphics)));
|
||||
return;
|
||||
}
|
||||
this.cogRecordDisplay1.StaticGraphics.AddList(graphics, "");
|
||||
cogRecordDisplay1.StaticGraphics.AddList(graphics, "");
|
||||
}
|
||||
private void ImageDisplay(CogImage8Grey img)
|
||||
{
|
||||
if (this.InvokeRequired)
|
||||
if (InvokeRequired)
|
||||
{
|
||||
this.BeginInvoke(new Action(() => ImageDisplay(img)));
|
||||
BeginInvoke(new Action(() => ImageDisplay(img)));
|
||||
return;
|
||||
}
|
||||
this.cogRecordDisplay1.Image = img;
|
||||
cogRecordDisplay1.Image = img;
|
||||
cogRecordDisplay1.StaticGraphics.Clear();
|
||||
}
|
||||
private void ImageDisplayFit()
|
||||
@@ -848,9 +834,9 @@ namespace WaferAlignment
|
||||
}
|
||||
private void DataDisplay(double Rotation, double X, double Y, double Radius)
|
||||
{
|
||||
if (this.InvokeRequired)
|
||||
if (InvokeRequired)
|
||||
{
|
||||
this.BeginInvoke(new Action(() => DataDisplay(Rotation, X, Y, Radius)));
|
||||
BeginInvoke(new Action(() => DataDisplay(Rotation, X, Y, Radius)));
|
||||
return;
|
||||
}
|
||||
int rowIndex = dataGridView1.Rows.Add();
|
||||
|
||||
@@ -140,16 +140,4 @@
|
||||
<metadata name="Column4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Column4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
||||
Reference in New Issue
Block a user