Commit 286377ea SK

Merge branch 'master' of https://gitee.com/sunky045/AccAOI

2 个父辈 c8488e39 1fad1fd0
...@@ -15,7 +15,7 @@ namespace AccAOI ...@@ -15,7 +15,7 @@ namespace AccAOI
public partial class FrmAoiSetting : Asa.Theme.FlatForm public partial class FrmAoiSetting : Asa.Theme.FlatForm
{ {
private control.ABaseControl aoiControl = null; private control.ABaseControl aoiControl = null;
private Image Img = null; public Image Img = null;
private AoiProject Project = null; private AoiProject Project = null;
public FrmAoiSetting() public FrmAoiSetting()
{ {
......
...@@ -24,6 +24,15 @@ namespace AccAOI.control ...@@ -24,6 +24,15 @@ namespace AccAOI.control
get { return panControl.Text; } get { return panControl.Text; }
set { panControl.Text = value; } set { panControl.Text = value; }
} }
public Image GetImg()
{
if (this.Parent != null && this.Parent is FrmAoiSetting)
{
return ((FrmAoiSetting)this.Parent).Img;
}
return null;
}
/// <summary> /// <summary>
/// 区域类型,1=矩形,2=圆形 /// 区域类型,1=矩形,2=圆形
/// </summary> /// </summary>
...@@ -32,14 +41,23 @@ namespace AccAOI.control ...@@ -32,14 +41,23 @@ namespace AccAOI.control
/// 区域信息 /// 区域信息
/// </summary> /// </summary>
public GraphicsPath currPath = null; public GraphicsPath currPath = null;
public ImageBox BImageBox; public ImageBox BImageBox;
public AoiMethod AoiInfo; public AoiMethod AoiInfo;
/// <summary>
/// 未处理的小图
/// </summary>
protected Image BaseImage = null; protected Image BaseImage = null;
public void SetImage(Image image) public void SetCurrPath(GraphicsPath path)
{
this.currPath = path;
UpdateImage();
}
public virtual void UpdateImage()
{ {
this.aoiImage.Image = image;
BaseImage = image;
} }
public virtual void ShowAoiInfo() public virtual void ShowAoiInfo()
{ {
......
...@@ -101,15 +101,16 @@ ...@@ -101,15 +101,16 @@
// chkwhiteOnBlack // chkwhiteOnBlack
// //
this.chkwhiteOnBlack.Inside = false; this.chkwhiteOnBlack.Inside = false;
this.chkwhiteOnBlack.Location = new System.Drawing.Point(151, 405); this.chkwhiteOnBlack.Location = new System.Drawing.Point(125, 419);
this.chkwhiteOnBlack.Name = "chkwhiteOnBlack"; this.chkwhiteOnBlack.Name = "chkwhiteOnBlack";
this.chkwhiteOnBlack.Size = new System.Drawing.Size(62, 30); this.chkwhiteOnBlack.Size = new System.Drawing.Size(62, 30);
this.chkwhiteOnBlack.TabIndex = 15; this.chkwhiteOnBlack.TabIndex = 15;
this.chkwhiteOnBlack.CheckedChanged += new Asa.Theme.Event.ValueChanged(this.chkwhiteOnBlack_CheckedChanged);
// //
// flatLabel2 // flatLabel2
// //
this.flatLabel2.Inside = false; this.flatLabel2.Inside = false;
this.flatLabel2.Location = new System.Drawing.Point(14, 405); this.flatLabel2.Location = new System.Drawing.Point(12, 419);
this.flatLabel2.Name = "flatLabel2"; this.flatLabel2.Name = "flatLabel2";
this.flatLabel2.Size = new System.Drawing.Size(75, 30); this.flatLabel2.Size = new System.Drawing.Size(75, 30);
this.flatLabel2.TabIndex = 16; this.flatLabel2.TabIndex = 16;
......
...@@ -23,6 +23,7 @@ namespace AccAOI.control ...@@ -23,6 +23,7 @@ namespace AccAOI.control
{ {
int value = trackBarThresh.Value; int value = trackBarThresh.Value;
lblthresh.Text = value.ToString(); lblthresh.Text = value.ToString();
UpdateImage();
} }
private AoiBlobMethod MethodBlob = null; private AoiBlobMethod MethodBlob = null;
public override void ShowAoiInfo() public override void ShowAoiInfo()
...@@ -74,8 +75,12 @@ namespace AccAOI.control ...@@ -74,8 +75,12 @@ namespace AccAOI.control
} }
return AoiInfo; return AoiInfo;
} }
private void UpdateImage() public override void UpdateImage()
{
if (BaseImage == null)
{ {
return;
}
GetAoiInfo(); GetAoiInfo();
Image outImage = null; Image outImage = null;
List<CvBlob> list = new List<CvBlob>(); List<CvBlob> list = new List<CvBlob>();
...@@ -89,5 +94,10 @@ namespace AccAOI.control ...@@ -89,5 +94,10 @@ namespace AccAOI.control
{ {
UpdateImage(); UpdateImage();
} }
private void chkwhiteOnBlack_CheckedChanged(object sender)
{
UpdateImage();
}
} }
} }
...@@ -8,6 +8,7 @@ using System.Text; ...@@ -8,6 +8,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using AOI; using AOI;
using Asa.Theme;
namespace AccAOI.control namespace AccAOI.control
{ {
...@@ -23,12 +24,18 @@ namespace AccAOI.control ...@@ -23,12 +24,18 @@ namespace AccAOI.control
if (this.AoiInfo is AoiMethodRgb) if (this.AoiInfo is AoiMethodRgb)
{ {
methodRgb = (AoiMethodRgb)AoiInfo; methodRgb = (AoiMethodRgb)AoiInfo;
txtMinR.Text = methodRgb.minR.ToString(); //txtMinR.Text = methodRgb.minR.ToString();
txtMaxR.Text = methodRgb.maxR.ToString(); //txtMaxR.Text = methodRgb.maxR.ToString();
txtMinG.Text = methodRgb.minG.ToString(); //txtMinG.Text = methodRgb.minG.ToString();
txtMaxG.Text = methodRgb.maxG.ToString(); // txtMaxG.Text = methodRgb.maxG.ToString();
txtMaxB.Text = methodRgb.maxB.ToString(); // txtMaxB.Text = methodRgb.maxB.ToString();
txtMinB.Text = methodRgb.minB.ToString(); // txtMinB.Text = methodRgb.minB.ToString();
SetTbValue(tbMinR, methodRgb.minR);
SetTbValue(tbMaxR, methodRgb.maxR);
SetTbValue(tbMinG, methodRgb.minG);
SetTbValue(tbMaxG, methodRgb.maxG);
SetTbValue(tbMaxB, methodRgb.maxB);
SetTbValue(tbMinB, methodRgb.minB);
txtminRate.Text = methodRgb.minRate.ToString(); txtminRate.Text = methodRgb.minRate.ToString();
txtmaxRate.Text = methodRgb.maxRate.ToString(); txtmaxRate.Text = methodRgb.maxRate.ToString();
} }
...@@ -46,6 +53,12 @@ namespace AccAOI.control ...@@ -46,6 +53,12 @@ namespace AccAOI.control
methodRgb.maxG = FormUtil.GetIntValue(txtMaxG); methodRgb.maxG = FormUtil.GetIntValue(txtMaxG);
methodRgb.maxB = FormUtil.GetIntValue(txtMaxB); methodRgb.maxB = FormUtil.GetIntValue(txtMaxB);
methodRgb.minB = FormUtil.GetIntValue(txtMinB); 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.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)
...@@ -59,8 +72,12 @@ namespace AccAOI.control ...@@ -59,8 +72,12 @@ namespace AccAOI.control
private void UpdateImage() public override void UpdateImage()
{ {
if (BaseImage == null)
{
return;
}
GetAoiInfo(); GetAoiInfo();
Image cutImg = null; Image cutImg = null;
Image dstCutImg = null; Image dstCutImg = null;
...@@ -79,5 +96,52 @@ namespace AccAOI.control ...@@ -79,5 +96,52 @@ namespace AccAOI.control
{ {
UpdateImage(); UpdateImage();
} }
private void tbMinR_ValueChanged(object sender, EventArgs e)
{
SetText(txtMinR, tbMinR.Value);
}
private void tbMaxR_ValueChanged(object sender, EventArgs e)
{
SetText(txtMaxR, tbMaxR.Value);
}
private void tbMinG_ValueChanged(object sender, EventArgs e)
{
SetText(txtMinG, tbMinG.Value);
}
private void tbMaxG_ValueChanged(object sender, EventArgs e)
{
SetText(txtMaxG, tbMaxG.Value);
}
private void tbMinB_ValueChanged(object sender, EventArgs e)
{
SetText(txtMinB, tbMinB.Value);
}
private void tbMaxB_ValueChanged(object sender, EventArgs e)
{
SetText(txtMaxB, tbMaxB.Value);
}
private void SetText(FlatText text, int value)
{
if (text.Text.ToString().Equals(value.ToString()))
{
return;
}
text.Text = value.ToString();
}
private void SetTbValue(TrackBar tb, int value)
{
if (tb.Value.Equals(value.ToString()))
{
return;
}
tb.Value = value;
}
} }
} }
此文件类型无法预览
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!