diff --git a/Tongue extraction_cropresizemethod/Tongue extraction/Form1.Designer.cs b/Tongue extraction_cropresizemethod/Tongue extraction/Form1.Designer.cs index bca39f5..27010d7 100644 --- a/Tongue extraction_cropresizemethod/Tongue extraction/Form1.Designer.cs +++ b/Tongue extraction_cropresizemethod/Tongue extraction/Form1.Designer.cs @@ -71,9 +71,9 @@ // this.button_start.Dock = System.Windows.Forms.DockStyle.Fill; this.button_start.Location = new System.Drawing.Point(0, 0); - this.button_start.Margin = new System.Windows.Forms.Padding(1, 2, 1, 2); + this.button_start.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.button_start.Name = "button_start"; - this.button_start.Size = new System.Drawing.Size(758, 49); + this.button_start.Size = new System.Drawing.Size(1263, 74); this.button_start.TabIndex = 0; this.button_start.Text = "Start"; this.button_start.UseVisualStyleBackColor = true; @@ -82,10 +82,10 @@ // pictureBox_input // this.pictureBox_input.Dock = System.Windows.Forms.DockStyle.Fill; - this.pictureBox_input.Location = new System.Drawing.Point(3, 4); - this.pictureBox_input.Margin = new System.Windows.Forms.Padding(1, 2, 1, 2); + this.pictureBox_input.Location = new System.Drawing.Point(4, 5); + this.pictureBox_input.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.pictureBox_input.Name = "pictureBox_input"; - this.pictureBox_input.Size = new System.Drawing.Size(250, 209); + this.pictureBox_input.Size = new System.Drawing.Size(417, 317); this.pictureBox_input.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pictureBox_input.TabIndex = 1; this.pictureBox_input.TabStop = false; @@ -93,10 +93,10 @@ // pictureBox_detection // this.pictureBox_detection.Dock = System.Windows.Forms.DockStyle.Fill; - this.pictureBox_detection.Location = new System.Drawing.Point(257, 4); - this.pictureBox_detection.Margin = new System.Windows.Forms.Padding(1, 2, 1, 2); + this.pictureBox_detection.Location = new System.Drawing.Point(427, 5); + this.pictureBox_detection.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.pictureBox_detection.Name = "pictureBox_detection"; - this.pictureBox_detection.Size = new System.Drawing.Size(250, 209); + this.pictureBox_detection.Size = new System.Drawing.Size(417, 317); this.pictureBox_detection.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pictureBox_detection.TabIndex = 2; this.pictureBox_detection.TabStop = false; @@ -104,10 +104,10 @@ // pictureBox_cropResized // this.pictureBox_cropResized.Dock = System.Windows.Forms.DockStyle.Fill; - this.pictureBox_cropResized.Location = new System.Drawing.Point(511, 4); - this.pictureBox_cropResized.Margin = new System.Windows.Forms.Padding(1, 2, 1, 2); + this.pictureBox_cropResized.Location = new System.Drawing.Point(850, 5); + this.pictureBox_cropResized.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.pictureBox_cropResized.Name = "pictureBox_cropResized"; - this.pictureBox_cropResized.Size = new System.Drawing.Size(250, 209); + this.pictureBox_cropResized.Size = new System.Drawing.Size(417, 317); this.pictureBox_cropResized.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pictureBox_cropResized.TabIndex = 3; this.pictureBox_cropResized.TabStop = false; @@ -115,10 +115,10 @@ // pictureBox_extraction // this.pictureBox_extraction.Dock = System.Windows.Forms.DockStyle.Fill; - this.pictureBox_extraction.Location = new System.Drawing.Point(511, 241); - this.pictureBox_extraction.Margin = new System.Windows.Forms.Padding(1, 2, 1, 2); + this.pictureBox_extraction.Location = new System.Drawing.Point(850, 362); + this.pictureBox_extraction.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.pictureBox_extraction.Name = "pictureBox_extraction"; - this.pictureBox_extraction.Size = new System.Drawing.Size(250, 209); + this.pictureBox_extraction.Size = new System.Drawing.Size(417, 317); this.pictureBox_extraction.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pictureBox_extraction.TabIndex = 4; this.pictureBox_extraction.TabStop = false; @@ -153,16 +153,16 @@ this.tableLayoutPanel1.Controls.Add(this.panel2, 3, 4); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); - this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(1, 2, 1, 2); + this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 6; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 44.44445F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 44.44444F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.11111F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(1018, 554); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(1697, 831); this.tableLayoutPanel1.TabIndex = 5; // // panel1 @@ -171,18 +171,19 @@ this.panel1.Controls.Add(this.textBox1); this.panel1.Controls.Add(this.button_start); this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel1.Location = new System.Drawing.Point(3, 478); - this.panel1.Margin = new System.Windows.Forms.Padding(1, 2, 1, 2); + this.panel1.Location = new System.Drawing.Point(4, 719); + this.panel1.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(758, 49); + this.panel1.Size = new System.Drawing.Size(1263, 74); this.panel1.TabIndex = 6; // // textBox1 // - this.textBox1.Location = new System.Drawing.Point(486, -1); + this.textBox1.Location = new System.Drawing.Point(810, -2); + this.textBox1.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4); this.textBox1.Multiline = true; this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(269, 60); + this.textBox1.Size = new System.Drawing.Size(446, 88); this.textBox1.TabIndex = 1; this.textBox1.Visible = false; // @@ -191,9 +192,10 @@ this.label1.AutoSize = true; this.label1.BackColor = System.Drawing.Color.White; this.label1.Dock = System.Windows.Forms.DockStyle.Fill; - this.label1.Location = new System.Drawing.Point(5, 217); + this.label1.Location = new System.Drawing.Point(7, 327); + this.label1.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(246, 20); + this.label1.Size = new System.Drawing.Size(411, 30); this.label1.TabIndex = 7; this.label1.Text = "Input"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -203,9 +205,10 @@ this.label2.AutoSize = true; this.label2.BackColor = System.Drawing.Color.White; this.label2.Dock = System.Windows.Forms.DockStyle.Fill; - this.label2.Location = new System.Drawing.Point(259, 217); + this.label2.Location = new System.Drawing.Point(430, 327); + this.label2.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(246, 20); + this.label2.Size = new System.Drawing.Size(411, 30); this.label2.TabIndex = 8; this.label2.Text = "Detection"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -215,9 +218,10 @@ this.label3.AutoSize = true; this.label3.BackColor = System.Drawing.Color.White; this.label3.Dock = System.Windows.Forms.DockStyle.Fill; - this.label3.Location = new System.Drawing.Point(513, 217); + this.label3.Location = new System.Drawing.Point(853, 327); + this.label3.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(246, 20); + this.label3.Size = new System.Drawing.Size(411, 30); this.label3.TabIndex = 9; this.label3.Text = "Crop+Resize"; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -227,9 +231,10 @@ this.label4.AutoSize = true; this.label4.BackColor = System.Drawing.Color.White; this.label4.Dock = System.Windows.Forms.DockStyle.Fill; - this.label4.Location = new System.Drawing.Point(767, 217); + this.label4.Location = new System.Drawing.Point(1276, 327); + this.label4.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(246, 20); + this.label4.Size = new System.Drawing.Size(414, 30); this.label4.TabIndex = 10; this.label4.Text = "Output"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -239,9 +244,10 @@ this.label5.AutoSize = true; this.label5.BackColor = System.Drawing.Color.White; this.label5.Dock = System.Windows.Forms.DockStyle.Fill; - this.label5.Location = new System.Drawing.Point(5, 454); + this.label5.Location = new System.Drawing.Point(7, 684); + this.label5.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(246, 20); + this.label5.Size = new System.Drawing.Size(411, 30); this.label5.TabIndex = 11; this.label5.Text = "Output+SRG"; this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -251,9 +257,10 @@ this.label6.AutoSize = true; this.label6.BackColor = System.Drawing.Color.White; this.label6.Dock = System.Windows.Forms.DockStyle.Fill; - this.label6.Location = new System.Drawing.Point(259, 454); + this.label6.Location = new System.Drawing.Point(430, 684); + this.label6.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(246, 20); + this.label6.Size = new System.Drawing.Size(411, 30); this.label6.TabIndex = 12; this.label6.Text = "Mask+SRG"; this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -263,9 +270,10 @@ this.label7.AutoSize = true; this.label7.BackColor = System.Drawing.Color.White; this.label7.Dock = System.Windows.Forms.DockStyle.Fill; - this.label7.Location = new System.Drawing.Point(513, 454); + this.label7.Location = new System.Drawing.Point(853, 684); + this.label7.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(246, 20); + this.label7.Size = new System.Drawing.Size(411, 30); this.label7.TabIndex = 13; this.label7.Text = "Extraction"; this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -275,9 +283,10 @@ this.label8.AutoSize = true; this.label8.BackColor = System.Drawing.Color.White; this.label8.Dock = System.Windows.Forms.DockStyle.Fill; - this.label8.Location = new System.Drawing.Point(767, 454); + this.label8.Location = new System.Drawing.Point(1276, 684); + this.label8.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(246, 20); + this.label8.Size = new System.Drawing.Size(414, 30); this.label8.TabIndex = 14; this.label8.Text = "Gloss"; this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -285,9 +294,10 @@ // pictureBox_output // this.pictureBox_output.Dock = System.Windows.Forms.DockStyle.Fill; - this.pictureBox_output.Location = new System.Drawing.Point(767, 5); + this.pictureBox_output.Location = new System.Drawing.Point(1276, 6); + this.pictureBox_output.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4); this.pictureBox_output.Name = "pictureBox_output"; - this.pictureBox_output.Size = new System.Drawing.Size(246, 207); + this.pictureBox_output.Size = new System.Drawing.Size(414, 315); this.pictureBox_output.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pictureBox_output.TabIndex = 15; this.pictureBox_output.TabStop = false; @@ -295,9 +305,10 @@ // pictureBox_outputSRG // this.pictureBox_outputSRG.Dock = System.Windows.Forms.DockStyle.Fill; - this.pictureBox_outputSRG.Location = new System.Drawing.Point(5, 242); + this.pictureBox_outputSRG.Location = new System.Drawing.Point(7, 363); + this.pictureBox_outputSRG.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4); this.pictureBox_outputSRG.Name = "pictureBox_outputSRG"; - this.pictureBox_outputSRG.Size = new System.Drawing.Size(246, 207); + this.pictureBox_outputSRG.Size = new System.Drawing.Size(411, 315); this.pictureBox_outputSRG.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pictureBox_outputSRG.TabIndex = 16; this.pictureBox_outputSRG.TabStop = false; @@ -305,9 +316,10 @@ // pictureBox_maskSRG // this.pictureBox_maskSRG.Dock = System.Windows.Forms.DockStyle.Fill; - this.pictureBox_maskSRG.Location = new System.Drawing.Point(259, 242); + this.pictureBox_maskSRG.Location = new System.Drawing.Point(430, 363); + this.pictureBox_maskSRG.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4); this.pictureBox_maskSRG.Name = "pictureBox_maskSRG"; - this.pictureBox_maskSRG.Size = new System.Drawing.Size(246, 207); + this.pictureBox_maskSRG.Size = new System.Drawing.Size(411, 315); this.pictureBox_maskSRG.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pictureBox_maskSRG.TabIndex = 17; this.pictureBox_maskSRG.TabStop = false; @@ -315,9 +327,10 @@ // pictureBox_gloss // this.pictureBox_gloss.Dock = System.Windows.Forms.DockStyle.Fill; - this.pictureBox_gloss.Location = new System.Drawing.Point(767, 242); + this.pictureBox_gloss.Location = new System.Drawing.Point(1276, 363); + this.pictureBox_gloss.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4); this.pictureBox_gloss.Name = "pictureBox_gloss"; - this.pictureBox_gloss.Size = new System.Drawing.Size(246, 207); + this.pictureBox_gloss.Size = new System.Drawing.Size(414, 315); this.pictureBox_gloss.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pictureBox_gloss.TabIndex = 18; this.pictureBox_gloss.TabStop = false; @@ -328,9 +341,10 @@ this.label_processingFileName.BackColor = System.Drawing.Color.White; this.tableLayoutPanel1.SetColumnSpan(this.label_processingFileName, 2); this.label_processingFileName.Dock = System.Windows.Forms.DockStyle.Fill; - this.label_processingFileName.Location = new System.Drawing.Point(5, 531); + this.label_processingFileName.Location = new System.Drawing.Point(7, 798); + this.label_processingFileName.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); this.label_processingFileName.Name = "label_processingFileName"; - this.label_processingFileName.Size = new System.Drawing.Size(500, 21); + this.label_processingFileName.Size = new System.Drawing.Size(834, 31); this.label_processingFileName.TabIndex = 19; this.label_processingFileName.Text = "Processing File: None"; this.label_processingFileName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; @@ -341,9 +355,10 @@ this.label_totalProgress.BackColor = System.Drawing.Color.White; this.tableLayoutPanel1.SetColumnSpan(this.label_totalProgress, 2); this.label_totalProgress.Dock = System.Windows.Forms.DockStyle.Fill; - this.label_totalProgress.Location = new System.Drawing.Point(513, 531); + this.label_totalProgress.Location = new System.Drawing.Point(853, 798); + this.label_totalProgress.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); this.label_totalProgress.Name = "label_totalProgress"; - this.label_totalProgress.Size = new System.Drawing.Size(500, 21); + this.label_totalProgress.Size = new System.Drawing.Size(837, 31); this.label_totalProgress.TabIndex = 20; this.label_totalProgress.Text = "Total Progress: 0/0"; this.label_totalProgress.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; @@ -352,9 +367,10 @@ // this.panel2.Controls.Add(this.button_pause); this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel2.Location = new System.Drawing.Point(767, 479); + this.panel2.Location = new System.Drawing.Point(1276, 720); + this.panel2.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4); this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(246, 47); + this.panel2.Size = new System.Drawing.Size(414, 72); this.panel2.TabIndex = 21; // // button_pause @@ -362,8 +378,9 @@ this.button_pause.Dock = System.Windows.Forms.DockStyle.Fill; this.button_pause.Enabled = false; this.button_pause.Location = new System.Drawing.Point(0, 0); + this.button_pause.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4); this.button_pause.Name = "button_pause"; - this.button_pause.Size = new System.Drawing.Size(246, 47); + this.button_pause.Size = new System.Drawing.Size(414, 72); this.button_pause.TabIndex = 0; this.button_pause.Text = "Pause"; this.button_pause.UseVisualStyleBackColor = true; @@ -376,14 +393,14 @@ // // Form1 // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 18F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1018, 554); + this.ClientSize = new System.Drawing.Size(1697, 831); this.Controls.Add(this.tableLayoutPanel1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Margin = new System.Windows.Forms.Padding(1, 2, 1, 2); + this.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.Name = "Form1"; - this.Text = "DeepTongue_GlossExtraction1.0"; + this.Text = "DeepTongue1.8"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); ((System.ComponentModel.ISupportInitialize)(this.pictureBox_input)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox_detection)).EndInit(); diff --git a/Tongue extraction_cropresizemethod/Tongue extraction/Form1.cs b/Tongue extraction_cropresizemethod/Tongue extraction/Form1.cs index e1e0dea..f0ea478 100644 --- a/Tongue extraction_cropresizemethod/Tongue extraction/Form1.cs +++ b/Tongue extraction_cropresizemethod/Tongue extraction/Form1.cs @@ -75,7 +75,7 @@ sw.WriteLine( "image" + "," + "top left X" + "," + "top left Y" + "," + "bottom right X" + "," + "bottom right Y" + "," + - "Width" + "," + "Height" + "," + "Area" + "," + "Gloss Count"); + "Width" + "," + "Height" + "," + "Area" + "," + "Gloss Count" + "," + "mean R" + "," + "mean G" + "," + "mean B"); } [Conditional("DEBUG")] @@ -792,6 +792,7 @@ label6.BackColor = Color.Red; mat_extraction = mat_input.Clone(); areaCount = 0; + var bgr = new double[3] { 0.0, 0.0, 0.0 }; for (int i = 0; i < mat_input.Height; i++) { for (int j = 0; j < mat_input.Width; j++) @@ -809,11 +810,17 @@ pix[0] = (byte)(mat_extraction.At(i, j).Item0); pix[1] = (byte)(mat_extraction.At(i, j).Item1); pix[2] = (byte)(mat_extraction.At(i, j).Item2); + bgr[0] += pix[0]; + bgr[1] += pix[1]; + bgr[2] += pix[2]; mat_extraction.Set(i, j, pix); areaCount++; } } } + bgr[0] /= areaCount; + bgr[1] /= areaCount; + bgr[2] /= areaCount; mat_extraction.SaveImage(basepath + "\\extraction" + imageFile); bitmap_bitch = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(mat_extraction); Invoke((MethodInvoker)delegate @@ -854,12 +861,17 @@ { for (int j = 0; j < mat_input.Width; j++) { + Vec3b pix = mat_gloss.At(i, j); if (mat_maskSRG.At(i, j) == 0) { + pix[0] = (byte)((pix[0] + pix[1] + pix[2]) / 3); + pix[1] = (byte)pix[0]; + pix[2] = (byte)pix[0]; + mat_gloss.Set(i, j, pix); } else { - Vec3b pix = mat_gloss.At(i, j); + if (pix.Item1 > thresh) { glossCount++; @@ -906,7 +918,8 @@ + P1.X.ToString() + "," + P1.Y.ToString() + "," + P2.X.ToString() + "," + P2.Y.ToString() + "," + Math.Abs(P1.X - P2.X).ToString() + "," + Math.Abs(P1.Y - P2.Y).ToString() + "," - + areaCount.ToString() + "," + glossCount.ToString() + + areaCount.ToString() + "," + glossCount.ToString() + "," + + bgr[2].ToString() + "," + bgr[1].ToString() + "," + bgr[0].ToString() ); }