Commit 8777cc79 LN

mark增加相似度配置

1 个父辈 e2666d23
...@@ -36,12 +36,19 @@ ...@@ -36,12 +36,19 @@
this.btnOpenImage = new Asa.Theme.FlatButton(); this.btnOpenImage = new Asa.Theme.FlatButton();
this.txtImage = new Asa.Theme.FlatText(); this.txtImage = new Asa.Theme.FlatText();
this.lblTime = new System.Windows.Forms.Label(); this.lblTime = new System.Windows.Forms.Label();
this.trackBarSamePercent = new System.Windows.Forms.TrackBar();
this.flatLabel3 = new Asa.Theme.FlatLabel();
this.txtSamePercent = new Asa.Theme.FlatText();
this.panParam.SuspendLayout(); this.panParam.SuspendLayout();
this.panResult.SuspendLayout(); this.panResult.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBarSamePercent)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// panParam // panParam
// //
this.panParam.Controls.Add(this.txtSamePercent);
this.panParam.Controls.Add(this.trackBarSamePercent);
this.panParam.Controls.Add(this.flatLabel3);
this.panParam.Controls.Add(this.flatLabel2); this.panParam.Controls.Add(this.flatLabel2);
this.panParam.Controls.Add(this.flatTextSearchZoom); this.panParam.Controls.Add(this.flatTextSearchZoom);
this.panParam.Controls.Add(this.flatLabel1); this.panParam.Controls.Add(this.flatLabel1);
...@@ -58,17 +65,18 @@ ...@@ -58,17 +65,18 @@
// flatLabel1 // flatLabel1
// //
this.flatLabel1.Inside = false; this.flatLabel1.Inside = false;
this.flatLabel1.Location = new System.Drawing.Point(14, 50); this.flatLabel1.Location = new System.Drawing.Point(14, 90);
this.flatLabel1.Name = "flatLabel1"; this.flatLabel1.Name = "flatLabel1";
this.flatLabel1.Size = new System.Drawing.Size(80, 30); this.flatLabel1.Size = new System.Drawing.Size(68, 30);
this.flatLabel1.TabIndex = 0; this.flatLabel1.TabIndex = 0;
this.flatLabel1.Text = "搜索区域:"; this.flatLabel1.Text = "搜索区域:";
this.flatLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
// //
// flatTextSearchZoom // flatTextSearchZoom
// //
this.flatTextSearchZoom.Font = new System.Drawing.Font("宋体", 9F); this.flatTextSearchZoom.Font = new System.Drawing.Font("宋体", 9F);
this.flatTextSearchZoom.Inside = false; this.flatTextSearchZoom.Inside = false;
this.flatTextSearchZoom.Location = new System.Drawing.Point(175, 50); this.flatTextSearchZoom.Location = new System.Drawing.Point(175, 90);
this.flatTextSearchZoom.Name = "flatTextSearchZoom"; this.flatTextSearchZoom.Name = "flatTextSearchZoom";
this.flatTextSearchZoom.Size = new System.Drawing.Size(95, 30); this.flatTextSearchZoom.Size = new System.Drawing.Size(95, 30);
this.flatTextSearchZoom.TabIndex = 1; this.flatTextSearchZoom.TabIndex = 1;
...@@ -77,7 +85,7 @@ ...@@ -77,7 +85,7 @@
// flatLabel2 // flatLabel2
// //
this.flatLabel2.Inside = false; this.flatLabel2.Inside = false;
this.flatLabel2.Location = new System.Drawing.Point(109, 50); this.flatLabel2.Location = new System.Drawing.Point(109, 90);
this.flatLabel2.Name = "flatLabel2"; this.flatLabel2.Name = "flatLabel2";
this.flatLabel2.Size = new System.Drawing.Size(65, 30); this.flatLabel2.Size = new System.Drawing.Size(65, 30);
this.flatLabel2.TabIndex = 2; this.flatLabel2.TabIndex = 2;
...@@ -138,6 +146,40 @@ ...@@ -138,6 +146,40 @@
this.lblTime.TabIndex = 8; this.lblTime.TabIndex = 8;
this.lblTime.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.lblTime.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
// //
// trackBarSamePercent
//
this.trackBarSamePercent.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.trackBarSamePercent.Location = new System.Drawing.Point(125, 40);
this.trackBarSamePercent.Maximum = 100;
this.trackBarSamePercent.Name = "trackBarSamePercent";
this.trackBarSamePercent.Size = new System.Drawing.Size(165, 45);
this.trackBarSamePercent.TabIndex = 12;
this.trackBarSamePercent.TickStyle = System.Windows.Forms.TickStyle.None;
this.trackBarSamePercent.Value = 50;
this.trackBarSamePercent.ValueChanged += new System.EventHandler(this.trackBarSamePercent_ValueChanged);
//
// flatLabel3
//
this.flatLabel3.Inside = false;
this.flatLabel3.Location = new System.Drawing.Point(14, 37);
this.flatLabel3.Name = "flatLabel3";
this.flatLabel3.Size = new System.Drawing.Size(55, 30);
this.flatLabel3.TabIndex = 11;
this.flatLabel3.Text = "相似度:";
this.flatLabel3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// txtSamePercent
//
this.txtSamePercent.Font = new System.Drawing.Font("宋体", 9F);
this.txtSamePercent.Inside = false;
this.txtSamePercent.Location = new System.Drawing.Point(75, 37);
this.txtSamePercent.Name = "txtSamePercent";
this.txtSamePercent.Padding = new System.Windows.Forms.Padding(3);
this.txtSamePercent.Size = new System.Drawing.Size(41, 30);
this.txtSamePercent.TabIndex = 26;
this.txtSamePercent.Text = "50";
this.txtSamePercent.TextChanged += new System.EventHandler(this.txtSamePercent_TextChanged);
//
// AioMarkControl // AioMarkControl
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
...@@ -146,7 +188,9 @@ ...@@ -146,7 +188,9 @@
this.Name = "AioMarkControl"; this.Name = "AioMarkControl";
this.TitleName = "Mark设置"; this.TitleName = "Mark设置";
this.panParam.ResumeLayout(false); this.panParam.ResumeLayout(false);
this.panParam.PerformLayout();
this.panResult.ResumeLayout(false); this.panResult.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.trackBarSamePercent)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
...@@ -161,5 +205,8 @@ ...@@ -161,5 +205,8 @@
private Asa.Theme.FlatText txtImage; private Asa.Theme.FlatText txtImage;
private Asa.Theme.FlatButton btnOpenImage; private Asa.Theme.FlatButton btnOpenImage;
private System.Windows.Forms.Label lblTime; private System.Windows.Forms.Label lblTime;
private System.Windows.Forms.TrackBar trackBarSamePercent;
private Asa.Theme.FlatLabel flatLabel3;
private Asa.Theme.FlatText txtSamePercent;
} }
} }
...@@ -11,6 +11,7 @@ using AOI; ...@@ -11,6 +11,7 @@ using AOI;
using System.Threading; using System.Threading;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.IO; using System.IO;
using Asa.Theme;
namespace AccAOI.control namespace AccAOI.control
{ {
...@@ -32,6 +33,10 @@ namespace AccAOI.control ...@@ -32,6 +33,10 @@ namespace AccAOI.control
{ {
method.RoiPath = currPath; method.RoiPath = currPath;
} }
int value =trackBarSamePercent.Value;
SetText(txtSamePercent, trackBarSamePercent.Value);
// int value = trackBarSamePercent.Value;
method.SamePercent = value;
AoiInfo = method; AoiInfo = method;
} }
return AoiInfo; return AoiInfo;
...@@ -84,6 +89,8 @@ namespace AccAOI.control ...@@ -84,6 +89,8 @@ namespace AccAOI.control
{ {
try try
{ {
int value = trackBarSamePercent.Value;
SetText(txtSamePercent, trackBarSamePercent.Value);
Image BaseImage = GetImg(); Image BaseImage = GetImg();
if (BaseImage == null || currPath == null) if (BaseImage == null || currPath == null)
{ {
...@@ -131,5 +138,44 @@ namespace AccAOI.control ...@@ -131,5 +138,44 @@ namespace AccAOI.control
txtImage.Text = fileName; txtImage.Text = fileName;
} }
private void trackBarSamePercent_ValueChanged(object sender, EventArgs e)
{
UpdateImage();
}
private void SetTbValue(TrackBar tb, int value)
{
if (tb.Value.Equals(value.ToString()))
{
return;
}
if (value < tb.Minimum)
{
tb.Value = tb.Minimum;
}
else if (value > tb.Maximum)
{
tb.Value = tb.Maximum;
}
else
{
tb.Value = value;
}
UpdateImage();
}
private void SetText(FlatText text, int value)
{
if (text.Text.ToString().Equals(value.ToString()))
{
return;
}
text.Text = value.ToString();
}
private void txtSamePercent_TextChanged(object sender, EventArgs e)
{
int value = FormUtil.GetIntValue(txtSamePercent);
SetTbValue(trackBarSamePercent, value);
UpdateImage();
}
} }
} }
namespace AccAOI.control using System;
namespace AccAOI.control
{ {
partial class AoiRgbControl partial class AoiRgbControl
{ {
...@@ -145,7 +147,7 @@ ...@@ -145,7 +147,7 @@
this.txtMaxR.Size = new System.Drawing.Size(41, 30); this.txtMaxR.Size = new System.Drawing.Size(41, 30);
this.txtMaxR.TabIndex = 26; this.txtMaxR.TabIndex = 26;
this.txtMaxR.Text = "255"; this.txtMaxR.Text = "255";
this.txtMaxR.TextChanged += new System.EventHandler(this.txtMinR_TextChanged); this.txtMaxR.TextChanged += new System.EventHandler(this.txtMaxR_TextChanged);
// //
// txtMinR // txtMinR
// //
...@@ -187,7 +189,7 @@ ...@@ -187,7 +189,7 @@
this.txtMaxG.Size = new System.Drawing.Size(41, 30); this.txtMaxG.Size = new System.Drawing.Size(41, 30);
this.txtMaxG.TabIndex = 30; this.txtMaxG.TabIndex = 30;
this.txtMaxG.Text = "255"; this.txtMaxG.Text = "255";
this.txtMaxG.TextChanged += new System.EventHandler(this.txtMinR_TextChanged); this.txtMaxG.TextChanged += new System.EventHandler(this.txtMaxG_TextChanged);
// //
// txtMinG // txtMinG
// //
...@@ -199,7 +201,7 @@ ...@@ -199,7 +201,7 @@
this.txtMinG.Size = new System.Drawing.Size(41, 30); this.txtMinG.Size = new System.Drawing.Size(41, 30);
this.txtMinG.TabIndex = 29; this.txtMinG.TabIndex = 29;
this.txtMinG.Text = "0"; this.txtMinG.Text = "0";
this.txtMinG.TextChanged += new System.EventHandler(this.txtMinR_TextChanged); this.txtMinG.TextChanged += new System.EventHandler(this.txtMinG_TextChanged);
// //
// flatLabel6 // flatLabel6
// //
...@@ -230,7 +232,7 @@ ...@@ -230,7 +232,7 @@
this.txtMaxB.Size = new System.Drawing.Size(41, 30); this.txtMaxB.Size = new System.Drawing.Size(41, 30);
this.txtMaxB.TabIndex = 34; this.txtMaxB.TabIndex = 34;
this.txtMaxB.Text = "255"; this.txtMaxB.Text = "255";
this.txtMaxB.TextChanged += new System.EventHandler(this.txtMinR_TextChanged); this.txtMaxB.TextChanged += new System.EventHandler(this.txtMaxB_TextChanged);
// //
// txtMinB // txtMinB
// //
...@@ -242,7 +244,7 @@ ...@@ -242,7 +244,7 @@
this.txtMinB.Size = new System.Drawing.Size(41, 30); this.txtMinB.Size = new System.Drawing.Size(41, 30);
this.txtMinB.TabIndex = 33; this.txtMinB.TabIndex = 33;
this.txtMinB.Text = "0"; this.txtMinB.Text = "0";
this.txtMinB.TextChanged += new System.EventHandler(this.txtMinR_TextChanged); this.txtMinB.TextChanged += new System.EventHandler(this.txtMinB_TextChanged);
// //
// flatLabel8 // flatLabel8
// //
...@@ -392,6 +394,8 @@ ...@@ -392,6 +394,8 @@
} }
#endregion #endregion
private Asa.Theme.FlatLabel flatLabel5; private Asa.Theme.FlatLabel flatLabel5;
......
...@@ -51,18 +51,19 @@ namespace AccAOI.control ...@@ -51,18 +51,19 @@ namespace AccAOI.control
{ {
methodRgb = (AoiMethodRgb)AoiInfo; methodRgb = (AoiMethodRgb)AoiInfo;
methodRgb.minR = FormUtil.GetIntValue(txtMinR); methodRgb.minR = tbMinR.Value;
methodRgb.maxR = FormUtil.GetIntValue(txtMaxR); methodRgb.maxR = tbMaxR.Value;
methodRgb.minG = FormUtil.GetIntValue(txtMinG); methodRgb.minG = tbMinG.Value;
methodRgb.maxG = FormUtil.GetIntValue(txtMaxG); methodRgb.maxG = tbMaxG.Value;
methodRgb.maxB = FormUtil.GetIntValue(txtMaxB); methodRgb.maxB = tbMaxB.Value;
methodRgb.minB = FormUtil.GetIntValue(txtMinB); methodRgb.minB = tbMinB.Value;
SetTbValue(tbMinR, methodRgb.minR); SetText(txtMinR, methodRgb.minR);
SetTbValue(tbMaxR, methodRgb.maxR); SetText(txtMaxR, methodRgb.maxR);
SetTbValue(tbMinG, methodRgb.minG); SetText(txtMinG, methodRgb.minG);
SetTbValue(tbMaxG, methodRgb.maxG); SetText(txtMaxG, methodRgb.maxG);
SetTbValue(tbMaxB, methodRgb.maxB); SetText(txtMaxB, methodRgb.maxB);
SetTbValue(tbMinB, methodRgb.minB); SetText(txtMinB, methodRgb.minB);
methodRgb.minRate = FormUtil.GetIntValue(txtminRate); methodRgb.minRate = FormUtil.GetIntValue(txtminRate);
methodRgb.maxRate = FormUtil.GetIntValue(txtmaxRate); methodRgb.maxRate = FormUtil.GetIntValue(txtmaxRate);
if (currPath != null) if (currPath != null)
...@@ -133,41 +134,81 @@ namespace AccAOI.control ...@@ -133,41 +134,81 @@ namespace AccAOI.control
UpdateImage(); UpdateImage();
} }
private void txtMinR_TextChanged(object sender, EventArgs e) //private void txtMinR_TextChanged(object sender, EventArgs e)
{ //{
UpdateImage(); // UpdateImage();
} //}
private void tbMinR_ValueChanged(object sender, EventArgs e) private void tbMinR_ValueChanged(object sender, EventArgs e)
{ {
SetText(txtMinR, tbMinR.Value); SetText(txtMinR, tbMinR.Value);
UpdateImage();
} }
private void tbMaxR_ValueChanged(object sender, EventArgs e) private void tbMaxR_ValueChanged(object sender, EventArgs e)
{ {
SetText(txtMaxR, tbMaxR.Value); SetText(txtMaxR, tbMaxR.Value);
UpdateImage();
} }
private void tbMinG_ValueChanged(object sender, EventArgs e) private void tbMinG_ValueChanged(object sender, EventArgs e)
{ {
SetText(txtMinG, tbMinG.Value); SetText(txtMinG, tbMinG.Value);
UpdateImage();
} }
private void tbMaxG_ValueChanged(object sender, EventArgs e) private void tbMaxG_ValueChanged(object sender, EventArgs e)
{ {
SetText(txtMaxG, tbMaxG.Value); SetText(txtMaxG, tbMaxG.Value);
UpdateImage();
} }
private void tbMinB_ValueChanged(object sender, EventArgs e) private void tbMinB_ValueChanged(object sender, EventArgs e)
{ {
SetText(txtMinB, tbMinB.Value); SetText(txtMinB, tbMinB.Value);
UpdateImage();
} }
private void tbMaxB_ValueChanged(object sender, EventArgs e) private void tbMaxB_ValueChanged(object sender, EventArgs e)
{ {
SetText(txtMaxB, tbMaxB.Value); SetText(txtMaxB, tbMaxB.Value);
UpdateImage();
}
private void txtMaxG_TextChanged(object sender, EventArgs e)
{
int value = FormUtil.GetIntValue(txtMaxG);
SetTbValue(tbMaxG, value);
}
private void txtMaxR_TextChanged(object sender, EventArgs e)
{
int value = FormUtil.GetIntValue(txtMaxR);
SetTbValue(tbMaxR, value);
} }
private void txtMinG_TextChanged(object sender, EventArgs e)
{
int value = FormUtil.GetIntValue(txtMinG);
SetTbValue(tbMinG, value);
}
private void txtMaxB_TextChanged(object sender, EventArgs e)
{
int value = FormUtil.GetIntValue(txtMaxB);
SetTbValue(tbMaxB, value);
}
private void txtMinR_TextChanged(object sender, EventArgs e)
{
int value = FormUtil.GetIntValue(txtMinR);
SetTbValue(tbMinR, value);
}
private void txtMinB_TextChanged(object sender, EventArgs e)
{
int value = FormUtil.GetIntValue(txtMinB);
SetTbValue(tbMinB, value);
}
private void SetText(FlatText text, int value) private void SetText(FlatText text, int value)
{ {
if (text.Text.ToString().Equals(value.ToString())) if (text.Text.ToString().Equals(value.ToString()))
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!