Commit 8777cc79 LN

mark增加相似度配置

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