|
@@ -159,7 +159,7 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
private decimal areaMin = 5;//宽
|
|
|
private decimal areaMax = 5;//长
|
|
|
private double rate = 0.3;//有效颗粒筛选占比
|
|
|
-
|
|
|
+ private int binaryValue = -1;//二值方法选择
|
|
|
|
|
|
|
|
|
private bool isExportResults = false;
|
|
@@ -210,6 +210,11 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
List<IEnumerable<OpenCvSharp.Point>> AllFieldsTemp = new List<IEnumerable<OpenCvSharp.Point>>();
|
|
|
private CheckBox checkBox5;
|
|
|
private Button btnDelRegion;
|
|
|
+ private GroupBox groupBox6;
|
|
|
+ private Label label2;
|
|
|
+ private NumericUpDown numericUpDown3;
|
|
|
+ private CheckBox checkBox6;
|
|
|
+ private CheckBox checkBox7;
|
|
|
|
|
|
//当前二值化图
|
|
|
Mat currentMat = new Mat();
|
|
@@ -363,10 +368,15 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
this.button7 = new System.Windows.Forms.Button();
|
|
|
this.button6 = new System.Windows.Forms.Button();
|
|
|
this.groupBox4 = new System.Windows.Forms.GroupBox();
|
|
|
+ this.btnDelRegion = new System.Windows.Forms.Button();
|
|
|
this.button13 = new System.Windows.Forms.Button();
|
|
|
this.button12 = new System.Windows.Forms.Button();
|
|
|
this.checkBox2 = new System.Windows.Forms.CheckBox();
|
|
|
- this.btnDelRegion = new System.Windows.Forms.Button();
|
|
|
+ this.groupBox6 = new System.Windows.Forms.GroupBox();
|
|
|
+ this.label2 = new System.Windows.Forms.Label();
|
|
|
+ this.numericUpDown3 = new System.Windows.Forms.NumericUpDown();
|
|
|
+ this.checkBox6 = new System.Windows.Forms.CheckBox();
|
|
|
+ this.checkBox7 = new System.Windows.Forms.CheckBox();
|
|
|
this.groupBox1.SuspendLayout();
|
|
|
this.groupBox2.SuspendLayout();
|
|
|
this.groupBox5.SuspendLayout();
|
|
@@ -377,11 +387,13 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
|
|
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit();
|
|
|
this.groupBox4.SuspendLayout();
|
|
|
+ this.groupBox6.SuspendLayout();
|
|
|
+ ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).BeginInit();
|
|
|
this.SuspendLayout();
|
|
|
//
|
|
|
// groupBox1
|
|
|
//
|
|
|
- this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
|
|
+ this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
|
|
| System.Windows.Forms.AnchorStyles.Right)));
|
|
|
this.groupBox1.Controls.Add(this.checkBox5);
|
|
|
this.groupBox1.Controls.Add(this.button4);
|
|
@@ -397,7 +409,7 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
//
|
|
|
// checkBox5
|
|
|
//
|
|
|
- this.checkBox5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
|
|
+ this.checkBox5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
|
|
| System.Windows.Forms.AnchorStyles.Right)));
|
|
|
this.checkBox5.Location = new System.Drawing.Point(753, 23);
|
|
|
this.checkBox5.Name = "checkBox5";
|
|
@@ -420,7 +432,7 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
//
|
|
|
// button2
|
|
|
//
|
|
|
- this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
|
|
+ this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
|
|
| System.Windows.Forms.AnchorStyles.Right)));
|
|
|
this.button2.Location = new System.Drawing.Point(929, 14);
|
|
|
this.button2.Name = "button2";
|
|
@@ -443,7 +455,7 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
//
|
|
|
// checkBox1
|
|
|
//
|
|
|
- this.checkBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
|
|
+ this.checkBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
|
|
| System.Windows.Forms.AnchorStyles.Left)));
|
|
|
this.checkBox1.AutoSize = true;
|
|
|
this.checkBox1.Checked = true;
|
|
@@ -456,7 +468,7 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
//
|
|
|
// button1
|
|
|
//
|
|
|
- this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
|
|
+ this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
|
|
| System.Windows.Forms.AnchorStyles.Left)));
|
|
|
this.button1.Location = new System.Drawing.Point(15, 14);
|
|
|
this.button1.Name = "button1";
|
|
@@ -489,7 +501,7 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
//
|
|
|
// groupBox2
|
|
|
//
|
|
|
- this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
|
|
+ this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
|
|
| System.Windows.Forms.AnchorStyles.Left)));
|
|
|
this.groupBox2.Controls.Add(this.listView1);
|
|
|
this.groupBox2.Location = new System.Drawing.Point(14, 60);
|
|
@@ -500,8 +512,8 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
//
|
|
|
// listView1
|
|
|
//
|
|
|
- this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
|
|
- | System.Windows.Forms.AnchorStyles.Left)
|
|
|
+ this.listView1.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.listView1.HideSelection = false;
|
|
|
this.listView1.LargeImageList = this.imageList1;
|
|
@@ -522,8 +534,8 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
//
|
|
|
// groupBox3
|
|
|
//
|
|
|
- this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
|
|
- | System.Windows.Forms.AnchorStyles.Left)
|
|
|
+ this.groupBox3.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.groupBox3.Location = new System.Drawing.Point(515, 60);
|
|
|
this.groupBox3.Name = "groupBox3";
|
|
@@ -621,12 +633,12 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
//
|
|
|
// groupBox8
|
|
|
//
|
|
|
- this.groupBox8.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
|
|
+ this.groupBox8.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
|
|
| System.Windows.Forms.AnchorStyles.Left)));
|
|
|
this.groupBox8.Controls.Add(this.dataGridView1);
|
|
|
- this.groupBox8.Location = new System.Drawing.Point(155, 308);
|
|
|
+ this.groupBox8.Location = new System.Drawing.Point(155, 408);
|
|
|
this.groupBox8.Name = "groupBox8";
|
|
|
- this.groupBox8.Size = new System.Drawing.Size(353, 358);
|
|
|
+ this.groupBox8.Size = new System.Drawing.Size(353, 258);
|
|
|
this.groupBox8.TabIndex = 8;
|
|
|
this.groupBox8.TabStop = false;
|
|
|
//
|
|
@@ -634,8 +646,8 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
//
|
|
|
this.dataGridView1.AllowUserToAddRows = false;
|
|
|
this.dataGridView1.AllowUserToDeleteRows = false;
|
|
|
- this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
|
|
- | System.Windows.Forms.AnchorStyles.Left)
|
|
|
+ this.dataGridView1.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.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
|
|
|
this.dataGridView1.BackgroundColor = System.Drawing.Color.White;
|
|
@@ -646,12 +658,12 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
this.dataGridView1.RowHeadersVisible = false;
|
|
|
this.dataGridView1.RowTemplate.Height = 23;
|
|
|
this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
|
|
- this.dataGridView1.Size = new System.Drawing.Size(340, 332);
|
|
|
+ this.dataGridView1.Size = new System.Drawing.Size(340, 232);
|
|
|
this.dataGridView1.TabIndex = 0;
|
|
|
//
|
|
|
// groupBox9
|
|
|
//
|
|
|
- this.groupBox9.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
|
|
+ this.groupBox9.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
|
|
| System.Windows.Forms.AnchorStyles.Right)));
|
|
|
this.groupBox9.Controls.Add(this.button3);
|
|
|
this.groupBox9.Controls.Add(this.label10);
|
|
@@ -755,8 +767,8 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
//
|
|
|
this.dataGridView2.AllowUserToAddRows = false;
|
|
|
this.dataGridView2.AllowUserToDeleteRows = false;
|
|
|
- this.dataGridView2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
|
|
- | System.Windows.Forms.AnchorStyles.Left)
|
|
|
+ this.dataGridView2.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.dataGridView2.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
|
|
|
this.dataGridView2.BackgroundColor = System.Drawing.Color.White;
|
|
@@ -772,7 +784,7 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
//
|
|
|
// listView2
|
|
|
//
|
|
|
- this.listView2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
|
|
+ this.listView2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
|
|
| System.Windows.Forms.AnchorStyles.Left)));
|
|
|
this.listView2.HideSelection = false;
|
|
|
this.listView2.Location = new System.Drawing.Point(16, 56);
|
|
@@ -815,6 +827,17 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
this.groupBox4.TabStop = false;
|
|
|
this.groupBox4.Text = "颗粒编辑";
|
|
|
//
|
|
|
+ // btnDelRegion
|
|
|
+ //
|
|
|
+ this.btnDelRegion.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
|
+ this.btnDelRegion.Location = new System.Drawing.Point(249, 32);
|
|
|
+ this.btnDelRegion.Name = "btnDelRegion";
|
|
|
+ this.btnDelRegion.Size = new System.Drawing.Size(84, 30);
|
|
|
+ this.btnDelRegion.TabIndex = 25;
|
|
|
+ this.btnDelRegion.Text = "区域删除";
|
|
|
+ this.btnDelRegion.UseVisualStyleBackColor = true;
|
|
|
+ this.btnDelRegion.Click += new System.EventHandler(this.DelRegionClick);
|
|
|
+ //
|
|
|
// button13
|
|
|
//
|
|
|
this.button13.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
@@ -849,21 +872,75 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
this.checkBox2.Text = "连续";
|
|
|
this.checkBox2.UseVisualStyleBackColor = true;
|
|
|
//
|
|
|
- // btnDelRegion
|
|
|
- //
|
|
|
- this.btnDelRegion.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
|
- this.btnDelRegion.Location = new System.Drawing.Point(249, 32);
|
|
|
- this.btnDelRegion.Name = "btnDelRegion";
|
|
|
- this.btnDelRegion.Size = new System.Drawing.Size(84, 30);
|
|
|
- this.btnDelRegion.TabIndex = 25;
|
|
|
- this.btnDelRegion.Text = "区域删除";
|
|
|
- this.btnDelRegion.UseVisualStyleBackColor = true;
|
|
|
- this.btnDelRegion.Click += new System.EventHandler(this.DelRegionClick);
|
|
|
+ // groupBox6
|
|
|
+ //
|
|
|
+ this.groupBox6.Controls.Add(this.label2);
|
|
|
+ this.groupBox6.Controls.Add(this.numericUpDown3);
|
|
|
+ this.groupBox6.Controls.Add(this.checkBox6);
|
|
|
+ this.groupBox6.Controls.Add(this.checkBox7);
|
|
|
+ this.groupBox6.Location = new System.Drawing.Point(155, 308);
|
|
|
+ this.groupBox6.Name = "groupBox6";
|
|
|
+ this.groupBox6.Size = new System.Drawing.Size(353, 94);
|
|
|
+ this.groupBox6.TabIndex = 11;
|
|
|
+ this.groupBox6.TabStop = false;
|
|
|
+ this.groupBox6.Text = "阈值调整";
|
|
|
+ //
|
|
|
+ // label2
|
|
|
+ //
|
|
|
+ this.label2.AutoSize = true;
|
|
|
+ this.label2.Location = new System.Drawing.Point(188, 61);
|
|
|
+ this.label2.Name = "label2";
|
|
|
+ this.label2.Size = new System.Drawing.Size(41, 12);
|
|
|
+ this.label2.TabIndex = 3;
|
|
|
+ this.label2.Text = "阈值:";
|
|
|
+ //
|
|
|
+ // numericUpDown3
|
|
|
+ //
|
|
|
+ this.numericUpDown3.Location = new System.Drawing.Point(238, 56);
|
|
|
+ this.numericUpDown3.Maximum = new decimal(new int[] {
|
|
|
+ 255,
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 0});
|
|
|
+ this.numericUpDown3.Name = "numericUpDown3";
|
|
|
+ this.numericUpDown3.Size = new System.Drawing.Size(52, 21);
|
|
|
+ this.numericUpDown3.TabIndex = 2;
|
|
|
+ this.numericUpDown3.Value = new decimal(new int[] {
|
|
|
+ 60,
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 0});
|
|
|
+ this.numericUpDown3.ValueChanged += new System.EventHandler(this.numericUpDown3_ValueChanged);
|
|
|
+ //
|
|
|
+ // checkBox6
|
|
|
+ //
|
|
|
+ this.checkBox6.AutoSize = true;
|
|
|
+ this.checkBox6.Location = new System.Drawing.Point(41, 61);
|
|
|
+ this.checkBox6.Name = "checkBox6";
|
|
|
+ this.checkBox6.Size = new System.Drawing.Size(72, 16);
|
|
|
+ this.checkBox6.TabIndex = 1;
|
|
|
+ this.checkBox6.Text = "固定阈值";
|
|
|
+ this.checkBox6.UseVisualStyleBackColor = true;
|
|
|
+ this.checkBox6.CheckedChanged += new System.EventHandler(this.checkBox6_CheckedChanged);
|
|
|
+ //
|
|
|
+ // checkBox7
|
|
|
+ //
|
|
|
+ this.checkBox7.AutoSize = true;
|
|
|
+ this.checkBox7.Checked = true;
|
|
|
+ this.checkBox7.CheckState = System.Windows.Forms.CheckState.Checked;
|
|
|
+ this.checkBox7.Location = new System.Drawing.Point(41, 25);
|
|
|
+ this.checkBox7.Name = "checkBox7";
|
|
|
+ this.checkBox7.Size = new System.Drawing.Size(60, 16);
|
|
|
+ this.checkBox7.TabIndex = 0;
|
|
|
+ this.checkBox7.Text = "大津法";
|
|
|
+ this.checkBox7.UseVisualStyleBackColor = true;
|
|
|
+ this.checkBox7.CheckedChanged += new System.EventHandler(this.checkBox7_CheckedChanged);
|
|
|
//
|
|
|
// BearingSteelStripRatingDialog
|
|
|
//
|
|
|
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
|
|
this.ClientSize = new System.Drawing.Size(1133, 881);
|
|
|
+ this.Controls.Add(this.groupBox6);
|
|
|
this.Controls.Add(this.groupBox4);
|
|
|
this.Controls.Add(this.groupBox9);
|
|
|
this.Controls.Add(this.groupBox8);
|
|
@@ -872,6 +949,7 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
this.Controls.Add(this.groupBox2);
|
|
|
this.Controls.Add(this.groupBox1);
|
|
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
|
|
+ this.Location = new System.Drawing.Point(0, 0);
|
|
|
this.Name = "BearingSteelStripRatingDialog";
|
|
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Dialog_FormClosing);
|
|
|
this.Load += new System.EventHandler(this.MicrostructureBandDialog_Load);
|
|
@@ -882,6 +960,7 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
this.Controls.SetChildIndex(this.groupBox8, 0);
|
|
|
this.Controls.SetChildIndex(this.groupBox9, 0);
|
|
|
this.Controls.SetChildIndex(this.groupBox4, 0);
|
|
|
+ this.Controls.SetChildIndex(this.groupBox6, 0);
|
|
|
this.groupBox1.ResumeLayout(false);
|
|
|
this.groupBox1.PerformLayout();
|
|
|
this.groupBox2.ResumeLayout(false);
|
|
@@ -896,6 +975,9 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit();
|
|
|
this.groupBox4.ResumeLayout(false);
|
|
|
this.groupBox4.PerformLayout();
|
|
|
+ this.groupBox6.ResumeLayout(false);
|
|
|
+ this.groupBox6.PerformLayout();
|
|
|
+ ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).EndInit();
|
|
|
this.ResumeLayout(false);
|
|
|
|
|
|
}
|
|
@@ -947,7 +1029,7 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
//
|
|
|
//获取系统标尺-微米
|
|
|
//
|
|
|
- //this.appWorkspace.getMeasureInfo().TryGetValue(MeasurementUnit.Micron, out unitLength);
|
|
|
+ this.appWorkspace.getMeasureInfo().TryGetValue(MeasurementUnit.Micron, out unitLength);
|
|
|
//二值化集成2
|
|
|
bc.OriginCheckedChangedAction += new EventHandler(this.bcOriginCheckedChanged);//初始化原图勾选改变事件
|
|
|
binaryClass.createDocumentItems(new string[] { PdnResources.GetString("Menu.BinaryAction.BinaryExtraction.Text"), PdnResources.GetString("Menu.Particlescreening.text") }
|
|
@@ -1956,7 +2038,7 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
CP.addParticle(cnt);
|
|
|
}
|
|
|
#endregion
|
|
|
- CP.draw(rate);
|
|
|
+ CP.draw(rate,unitLength);
|
|
|
double distance = (double)Math.Round(CP.getAllDistance() * 100) / 100;
|
|
|
double avgarea = (double)Math.Round(CP.getAvgArea() * 100) / 100;
|
|
|
double maxarea = (double)Math.Round(CP.getMaxArea() * 100) / 100;
|
|
@@ -2015,7 +2097,7 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
private void numericUpDown2_ValueChanged(object sender, EventArgs e)
|
|
|
{
|
|
|
rate = (double)this.numericUpDown2.Value;
|
|
|
- if (this.checkBox3.Checked && bcBinaryChecked())
|
|
|
+ if (this.checkBox3.Checked )
|
|
|
ReloadDebrisSelection();
|
|
|
}
|
|
|
|
|
@@ -2817,7 +2899,15 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
else
|
|
|
{
|
|
|
srcGray = source.CvtColor(ColorConversionCodes.BGR2GRAY);
|
|
|
- Cv2.Threshold(srcGray, srcGray, 0, 255, ThresholdTypes.Otsu);
|
|
|
+ //修改-20221114
|
|
|
+ if (binaryValue == -1)
|
|
|
+ {
|
|
|
+ Cv2.Threshold(srcGray, srcGray, 0, 255, ThresholdTypes.Otsu);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Cv2.Threshold(srcGray, srcGray, binaryValue, 255, ThresholdTypes.Binary);
|
|
|
+ }
|
|
|
}
|
|
|
currentMat = srcGray.Clone();
|
|
|
OpenCvSharp.Point[][] contours = new OpenCvSharp.Point[][] { };
|
|
@@ -2892,7 +2982,58 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ /// <summary>
|
|
|
+ /// 20221114-添加二值阈值
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="sender"></param>
|
|
|
+ /// <param name="e"></param>
|
|
|
+ private void checkBox7_CheckedChanged(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ if (this.checkBox7.Checked == true)
|
|
|
+ {
|
|
|
+ this.checkBox7.Checked = true;
|
|
|
+ this.checkBox6.Checked = false;
|
|
|
+ this.label2.Visible = false;
|
|
|
+ this.numericUpDown3.Visible = false;
|
|
|
+ binaryValue = -1;
|
|
|
+
|
|
|
+ }
|
|
|
+ if (this.documentWorkspace == null || this.documentWorkspace.CompositionSurface == null)
|
|
|
+ return;
|
|
|
+ GetPoints(imageMat);
|
|
|
+ ReloadDebrisSelection();
|
|
|
+
|
|
|
+ this.documentWorkspace.Refresh();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void checkBox6_CheckedChanged(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ if (this.checkBox6.Checked == true)
|
|
|
+ {
|
|
|
+ this.checkBox6.Checked = true;
|
|
|
+ this.label2.Visible = true;
|
|
|
+ this.numericUpDown3.Visible = true;
|
|
|
+ binaryValue = (int)numericUpDown3.Value;
|
|
|
+ this.checkBox7.Checked = false;
|
|
|
+ }
|
|
|
+ if (this.documentWorkspace == null || this.documentWorkspace.CompositionSurface == null)
|
|
|
+ return;
|
|
|
+ GetPoints(imageMat);
|
|
|
+ ReloadDebrisSelection();
|
|
|
+
|
|
|
+ this.documentWorkspace.Refresh();
|
|
|
+ }
|
|
|
|
|
|
+ private void numericUpDown3_ValueChanged(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ binaryValue = (int)numericUpDown3.Value;
|
|
|
+ if (this.checkBox6.Checked )
|
|
|
+ {
|
|
|
+ GetPoints(imageMat);
|
|
|
+ ReloadDebrisSelection();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public class BearingSteelProcessor
|
|
@@ -2902,9 +3043,9 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
|
|
|
|
|
|
[DllImport("BearingSteelDLL.dll", CallingConvention = CallingConvention.Cdecl)]
|
|
|
- private static extern void run(IntPtr pClassObject, IntPtr img, double rate, bool isFillHole);
|
|
|
+ private static extern void run(IntPtr pClassObject, IntPtr img, double rate, bool isFillHole,double unitlength);
|
|
|
[DllImport("BearingSteelDLL.dll", CallingConvention = CallingConvention.Cdecl)]
|
|
|
- private static extern void draw(IntPtr pClassObject, double rate);
|
|
|
+ private static extern void draw(IntPtr pClassObject, double rate,double unitlength);
|
|
|
|
|
|
[DllImport("BearingSteelDLL.dll", CallingConvention = CallingConvention.Cdecl)]
|
|
|
private static extern int getParticleCount(IntPtr pClassObject);
|
|
@@ -2953,13 +3094,13 @@ namespace PaintDotNet.DedicatedAnalysis.BearingSteelStripRating.GB18254
|
|
|
/// 颗粒检测
|
|
|
/// </summary>
|
|
|
|
|
|
- public void run(Mat img, double rate, bool isFillHole)
|
|
|
+ public void run(Mat img, double rate, bool isFillHole,double unitlength)
|
|
|
{
|
|
|
- run(this.p_Object, img.CvPtr, rate, isFillHole);
|
|
|
+ run(this.p_Object, img.CvPtr, rate, isFillHole, unitlength);
|
|
|
}
|
|
|
- public void draw(double rate)
|
|
|
+ public void draw(double rate, double unitlength)
|
|
|
{
|
|
|
- draw(this.p_Object, rate);
|
|
|
+ draw(this.p_Object, rate, unitlength);
|
|
|
}
|
|
|
|
|
|
public int getParticleCount()
|