Commit 60a3f895 cuiya

optimize

1 个父辈 86c5ac4c
......@@ -119,6 +119,11 @@ namespace Acc.Demo
sw.Start();
int itemFeature = int.Parse(textBoxFeature.Text);
Image image = orginalImage;
if (!ImageUtil.selectB)
{
itemFeature = ImageUtil.GetItemFeatureAuto(image, markX, markY, theshValue);
}
ImageUtil.selectB = false;
int count = ImageUtil.CountItems(ref image, itemFeature, theshValue);
sw.Stop();
labelTime.Text = "耗时:" + sw.ElapsedMilliseconds + " ms";
......@@ -152,6 +157,7 @@ namespace Acc.Demo
{
theshValue = int.Parse(textBoxThesh.Text);
}
ImageUtil.selectB = true;
int feature = ImageUtil.GetItemFeature(orginalImage, markX, markY, theshValue);
labelFeature.Text = "特征值:" + feature + "";
textBoxFeature.Text = feature + "";
......
......@@ -30,7 +30,6 @@
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
this.imageBox = new Cyotek.Windows.Forms.ImageBox();
this.contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
this.打开图片ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.原图ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
......@@ -49,24 +48,11 @@
this.labelTime = new System.Windows.Forms.Label();
this.textBoxFeature = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.imageBox = new Cyotek.Windows.Forms.ImageBox();
this.contextMenuStrip.SuspendLayout();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// imageBox
//
this.imageBox.AllowDrop = true;
this.imageBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.imageBox.Location = new System.Drawing.Point(16, 52);
this.imageBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.imageBox.Name = "imageBox";
this.imageBox.Size = new System.Drawing.Size(817, 458);
this.imageBox.TabIndex = 0;
this.imageBox.MouseDown += new System.Windows.Forms.MouseEventHandler(this.imageBox_MouseDown);
//
// contextMenuStrip
//
this.contextMenuStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
......@@ -145,6 +131,7 @@
this.buttonThesh.TabIndex = 3;
this.buttonThesh.Text = "二值化";
this.buttonThesh.UseVisualStyleBackColor = true;
this.buttonThesh.Visible = false;
this.buttonThesh.Click += new System.EventHandler(this.buttonThesh_Click);
//
// textBoxThesh
......@@ -155,6 +142,7 @@
this.textBoxThesh.Size = new System.Drawing.Size(60, 25);
this.textBoxThesh.TabIndex = 4;
this.textBoxThesh.Text = "30";
this.textBoxThesh.Visible = false;
//
// checkBoxAutoThresh
//
......@@ -166,6 +154,7 @@
this.checkBoxAutoThresh.TabIndex = 5;
this.checkBoxAutoThresh.Text = "自动";
this.checkBoxAutoThresh.UseVisualStyleBackColor = true;
this.checkBoxAutoThresh.Visible = false;
this.checkBoxAutoThresh.CheckedChanged += new System.EventHandler(this.checkBoxAutoThresh_CheckedChanged);
//
// panel1
......@@ -236,6 +225,7 @@
this.textBoxFeature.Size = new System.Drawing.Size(60, 25);
this.textBoxFeature.TabIndex = 8;
this.textBoxFeature.Text = "200";
this.textBoxFeature.Visible = false;
//
// label1
//
......@@ -246,22 +236,26 @@
this.label1.Size = new System.Drawing.Size(82, 15);
this.label1.TabIndex = 9;
this.label1.Text = "元件特征:";
this.label1.Visible = false;
//
// button1
// imageBox
//
this.button1.Location = new System.Drawing.Point(263, 18);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 10;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.imageBox.AllowDrop = true;
this.imageBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.imageBox.Location = new System.Drawing.Point(16, 52);
this.imageBox.Margin = new System.Windows.Forms.Padding(4);
this.imageBox.Name = "imageBox";
this.imageBox.Size = new System.Drawing.Size(817, 458);
this.imageBox.TabIndex = 0;
this.imageBox.MouseDown += new System.Windows.Forms.MouseEventHandler(this.imageBox_MouseDown);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(851, 544);
this.Controls.Add(this.button1);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBoxFeature);
this.Controls.Add(this.panel1);
......@@ -303,7 +297,6 @@
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ToolStripMenuItem 计数ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 保存当前图片ToolStripMenuItem;
private System.Windows.Forms.Button button1;
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!