Commit fe992407 LN

修改界面

1 个父辈 b94db01c
......@@ -176,7 +176,7 @@ namespace AccAOI
aoiControl.FormBorderStyle = FormBorderStyle.None;
aoiControl.StartPosition = FormStartPosition.CenterParent;
aoiControl.Location = new Point(0, 0);
aoiControl.SetImageBox(this.imageBox1);
aoiControl.BImageBox=this.imageBox1;
aoiControl.AoiInfo = method;
aoiControl.Size = panAoi.Size;
aoiControl.TitleName = method.MethodName;
......@@ -193,7 +193,7 @@ namespace AccAOI
cutImage = threshImage;
aoiControl.currPath = currPath;
aoiControl.aoiImage.Image = threshImage;
aoiControl.SetImage( threshImage);
}
}
private void SaveCurrAoi()
......@@ -287,7 +287,7 @@ namespace AccAOI
cutImage = threshImage;
aoiControl.currPath = currPath;
aoiControl.aoiImage.Image = threshImage;
aoiControl.SetImage( threshImage);
}catch(Exception ex)
{
......
......@@ -32,19 +32,15 @@ namespace AccAOI.control
/// 区域信息
/// </summary>
public GraphicsPath currPath = null;
internal ImageBoxEx BImageBox;
internal AoiMethod AoiInfo;
public void SetImageBox(ImageBoxEx box)
public ImageBoxEx BImageBox;
public AoiMethod AoiInfo;
protected Image BaseImage = null;
public void SetImage(Image image)
{
this.BImageBox = box;
this.aoiImage.Image = image;
BaseImage = image;
}
public void SeetAoiInfo(AoiMethod aoi)
{
this.AoiInfo = aoi;
}
public virtual void ShowAoiInfo()
{
......
......@@ -23,26 +23,26 @@ namespace AccAOI.control
int value = trackBarThresh.Value;
lblthresh.Text = value.ToString();
}
private AoiBlobMethod MethodBlob = null;
public override void ShowAoiInfo()
{
if(this.AoiInfo is AoiBlobMethod)
{
AoiBlobMethod aInfo = (AoiBlobMethod)AoiInfo;
if (aInfo.thresh < 0)
MethodBlob = (AoiBlobMethod)AoiInfo;
if (MethodBlob.thresh < 0)
{
trackBarThresh.Value = 0;
}
else
{
trackBarThresh.Value = aInfo.thresh;
trackBarThresh.Value = MethodBlob.thresh;
}
chkwhiteOnBlack.Checked = aInfo.whiteOnBlack;
txtmaxArea.Text = aInfo.maxArea.ToString();
txtminArea.Text = aInfo.minArea.ToString();
txtmaxNum.Text = aInfo.maxNum.ToString();
txtminNum.Text = aInfo.minNum.ToString();
chkwhiteOnBlack.Checked = MethodBlob.whiteOnBlack;
txtmaxArea.Text = MethodBlob.maxArea.ToString();
txtminArea.Text = MethodBlob.minArea.ToString();
txtmaxNum.Text = MethodBlob.maxNum.ToString();
txtminNum.Text = MethodBlob.minNum.ToString();
}
}
......@@ -50,27 +50,39 @@ namespace AccAOI.control
{
if (this.AoiInfo is AoiBlobMethod)
{
AoiBlobMethod aInfo = (AoiBlobMethod)AoiInfo;
MethodBlob = (AoiBlobMethod)AoiInfo;
if (trackBarThresh.Value.Equals(0))
{
aInfo.thresh = -1;
MethodBlob.thresh = -1;
}
else
{
aInfo.thresh= trackBarThresh.Value;
MethodBlob.thresh= trackBarThresh.Value;
}
aInfo.whiteOnBlack= chkwhiteOnBlack.Checked ;
aInfo.maxArea = FormUtil.GetIntValue(txtmaxArea);
aInfo.minArea = FormUtil.GetIntValue(txtminArea);
aInfo.maxNum = FormUtil.GetIntValue(txtmaxNum);
aInfo.minNum = FormUtil.GetIntValue(txtminNum);
MethodBlob.whiteOnBlack= chkwhiteOnBlack.Checked ;
MethodBlob.maxArea = FormUtil.GetIntValue(txtmaxArea);
MethodBlob.minArea = FormUtil.GetIntValue(txtminArea);
MethodBlob.maxNum = FormUtil.GetIntValue(txtmaxNum);
MethodBlob.minNum = FormUtil.GetIntValue(txtminNum);
if (currPath != null)
{
aInfo.RoiPath = currPath;
MethodBlob.RoiPath = currPath;
}
AoiInfo = MethodBlob;
}
return AoiInfo;
}
private void UpdateImage()
{
GetAoiInfo();
Image outImage = null;
//List<CvBlob> list = new List<CvBlob>();
//float blob = MethodBlob.GetBlobNum(BaseImage, out outImage,out list);
//txtRate.Text = rate.ToString();
this.aoiImage.Image = outImage;
}
}
}
......@@ -44,15 +44,18 @@
this.txtMaxB = new Asa.Theme.FlatText();
this.txtMinB = new Asa.Theme.FlatText();
this.flatLabel8 = new Asa.Theme.FlatLabel();
this.txtRate = new Asa.Theme.FlatText();
this.flatLabel9 = new Asa.Theme.FlatLabel();
this.btnUpdate = new Asa.Theme.FlatButton();
this.SuspendLayout();
//
// panParam
//
this.panParam.Size = new System.Drawing.Size(291, 166);
this.panParam.Size = new System.Drawing.Size(298, 166);
//
// panResult
//
this.panResult.Size = new System.Drawing.Size(291, 189);
this.panResult.Size = new System.Drawing.Size(298, 189);
//
// flatLabel5
//
......@@ -110,6 +113,7 @@
this.txtMaxR.Padding = new System.Windows.Forms.Padding(3);
this.txtMaxR.Size = new System.Drawing.Size(74, 30);
this.txtMaxR.TabIndex = 26;
this.txtMaxR.TextChanged += new System.EventHandler(this.txtMinR_TextChanged);
//
// txtMinR
//
......@@ -120,6 +124,7 @@
this.txtMinR.Padding = new System.Windows.Forms.Padding(3);
this.txtMinR.Size = new System.Drawing.Size(74, 30);
this.txtMinR.TabIndex = 25;
this.txtMinR.TextChanged += new System.EventHandler(this.txtMinR_TextChanged);
//
// flatLabel2
//
......@@ -148,6 +153,7 @@
this.txtMaxG.Padding = new System.Windows.Forms.Padding(3);
this.txtMaxG.Size = new System.Drawing.Size(74, 30);
this.txtMaxG.TabIndex = 30;
this.txtMaxG.TextChanged += new System.EventHandler(this.txtMinR_TextChanged);
//
// txtMinG
//
......@@ -158,6 +164,7 @@
this.txtMinG.Padding = new System.Windows.Forms.Padding(3);
this.txtMinG.Size = new System.Drawing.Size(74, 30);
this.txtMinG.TabIndex = 29;
this.txtMinG.TextChanged += new System.EventHandler(this.txtMinR_TextChanged);
//
// flatLabel6
//
......@@ -186,6 +193,7 @@
this.txtMaxB.Padding = new System.Windows.Forms.Padding(3);
this.txtMaxB.Size = new System.Drawing.Size(74, 30);
this.txtMaxB.TabIndex = 34;
this.txtMaxB.TextChanged += new System.EventHandler(this.txtMinR_TextChanged);
//
// txtMinB
//
......@@ -196,6 +204,7 @@
this.txtMinB.Padding = new System.Windows.Forms.Padding(3);
this.txtMinB.Size = new System.Drawing.Size(74, 30);
this.txtMinB.TabIndex = 33;
this.txtMinB.TextChanged += new System.EventHandler(this.txtMinR_TextChanged);
//
// flatLabel8
//
......@@ -206,11 +215,46 @@
this.flatLabel8.TabIndex = 32;
this.flatLabel8.Text = "B:";
//
// txtRate
//
this.txtRate.Enabled = false;
this.txtRate.Font = new System.Drawing.Font("宋体", 9F);
this.txtRate.Inside = false;
this.txtRate.Location = new System.Drawing.Point(108, 577);
this.txtRate.Name = "txtRate";
this.txtRate.Padding = new System.Windows.Forms.Padding(3);
this.txtRate.Size = new System.Drawing.Size(74, 30);
this.txtRate.TabIndex = 36;
//
// flatLabel9
//
this.flatLabel9.Inside = false;
this.flatLabel9.Location = new System.Drawing.Point(19, 577);
this.flatLabel9.Name = "flatLabel9";
this.flatLabel9.Size = new System.Drawing.Size(83, 30);
this.flatLabel9.TabIndex = 37;
this.flatLabel9.Text = "像素实时占比:";
//
// btnUpdate
//
this.btnUpdate.ImageSize = new System.Drawing.Size(0, 0);
this.btnUpdate.Inside = false;
this.btnUpdate.Location = new System.Drawing.Point(204, 577);
this.btnUpdate.Name = "btnUpdate";
this.btnUpdate.Size = new System.Drawing.Size(90, 30);
this.btnUpdate.StateColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.btnUpdate.TabIndex = 38;
this.btnUpdate.Text = "更新";
this.btnUpdate.Click += new System.EventHandler(this.btnUpdate_Click);
//
// AoiRgbControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(312, 700);
this.Controls.Add(this.btnUpdate);
this.Controls.Add(this.flatLabel9);
this.Controls.Add(this.txtRate);
this.Controls.Add(this.flatLabel7);
this.Controls.Add(this.txtMaxB);
this.Controls.Add(this.txtMinB);
......@@ -229,6 +273,7 @@
this.Controls.Add(this.flatLabel3);
this.Name = "AoiRgbControl";
this.TitleName = "颜色抽取";
this.Controls.SetChildIndex(this.aoiImage, 0);
this.Controls.SetChildIndex(this.panParam, 0);
this.Controls.SetChildIndex(this.panResult, 0);
this.Controls.SetChildIndex(this.flatLabel3, 0);
......@@ -247,6 +292,9 @@
this.Controls.SetChildIndex(this.txtMinB, 0);
this.Controls.SetChildIndex(this.txtMaxB, 0);
this.Controls.SetChildIndex(this.flatLabel7, 0);
this.Controls.SetChildIndex(this.txtRate, 0);
this.Controls.SetChildIndex(this.flatLabel9, 0);
this.Controls.SetChildIndex(this.btnUpdate, 0);
this.ResumeLayout(false);
}
......@@ -269,5 +317,8 @@
private Asa.Theme.FlatText txtMaxB;
private Asa.Theme.FlatText txtMinB;
private Asa.Theme.FlatLabel flatLabel8;
private Asa.Theme.FlatText txtRate;
private Asa.Theme.FlatLabel flatLabel9;
private Asa.Theme.FlatButton btnUpdate;
}
}
......@@ -17,19 +17,20 @@ namespace AccAOI.control
{
InitializeComponent();
}
private AoiMethodRgb methodRgb = null;
public override void ShowAoiInfo()
{
if (this.AoiInfo is AoiMethodRgb)
{
AoiMethodRgb aInfo = (AoiMethodRgb)AoiInfo;
txtMinR.Text = aInfo.minR.ToString();
txtMaxR.Text = aInfo.maxR.ToString();
txtMinG.Text = aInfo.minG.ToString();
txtMaxG.Text = aInfo.maxG.ToString();
txtMaxB.Text = aInfo.maxB.ToString();
txtMinB.Text = aInfo.minB.ToString();
txtminRate.Text = aInfo.minRate.ToString();
txtmaxRate.Text = aInfo.maxRate.ToString();
methodRgb = (AoiMethodRgb)AoiInfo;
txtMinR.Text = methodRgb.minR.ToString();
txtMaxR.Text = methodRgb.maxR.ToString();
txtMinG.Text = methodRgb.minG.ToString();
txtMaxG.Text = methodRgb.maxG.ToString();
txtMaxB.Text = methodRgb.maxB.ToString();
txtMinB.Text = methodRgb.minB.ToString();
txtminRate.Text = methodRgb.minRate.ToString();
txtmaxRate.Text = methodRgb.maxRate.ToString();
}
}
......@@ -37,22 +38,48 @@ namespace AccAOI.control
{
if (this.AoiInfo is AoiMethodRgb)
{
AoiMethodRgb aInfo = (AoiMethodRgb)AoiInfo;
aInfo.minR = FormUtil.GetIntValue(txtMinR);
aInfo.maxR = FormUtil.GetIntValue(txtMaxR);
aInfo.minG = FormUtil.GetIntValue(txtMinG);
aInfo.maxG = FormUtil.GetIntValue(txtMaxG);
aInfo.maxB = FormUtil.GetIntValue(txtMaxB);
aInfo.minB = FormUtil.GetIntValue(txtMinB);
aInfo.minRate = FormUtil.GetIntValue(txtminRate);
aInfo.maxRate = FormUtil.GetIntValue(txtmaxRate);
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);
methodRgb.minRate = FormUtil.GetIntValue(txtminRate);
methodRgb.maxRate = FormUtil.GetIntValue(txtmaxRate);
if (currPath != null)
{
aInfo.RoiPath = currPath;
methodRgb.RoiPath = currPath;
}
AoiInfo = methodRgb;
}
return AoiInfo;
}
private void UpdateImage()
{
GetAoiInfo();
Image outImage = null;
float rate = methodRgb.GetRate(BaseImage, out outImage);
if (double.IsNaN(rate))
{
return;
}
txtRate.Text = rate.ToString();
this.aoiImage.Image = outImage;
}
private void btnUpdate_Click(object sender, EventArgs e)
{
UpdateImage();
}
private void txtMinR_TextChanged(object sender, EventArgs e)
{
UpdateImage();
}
}
}
此文件类型无法预览
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!