diff --git a/Tongue extraction_cropresizemethod/Tongue extraction.sln b/Tongue extraction_cropresizemethod/Tongue extraction.sln
index e79838b..488d474 100644
--- a/Tongue extraction_cropresizemethod/Tongue extraction.sln
+++ b/Tongue extraction_cropresizemethod/Tongue extraction.sln
@@ -3,7 +3,7 @@
# Visual Studio Version 16
VisualStudioVersion = 16.0.30011.22
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeepTongue1.7", "Tongue extraction\DeepTongue1.7.csproj", "{AFD610B1-8D23-423A-AA0F-B09BA769BDD7}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeepTongue2.0", "Tongue extraction\DeepTongue2.0.csproj", "{AFD610B1-8D23-423A-AA0F-B09BA769BDD7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/Tongue extraction_cropresizemethod/Tongue extraction/DeepTongue1.7.csproj b/Tongue extraction_cropresizemethod/Tongue extraction/DeepTongue1.7.csproj
deleted file mode 100644
index f34ab27..0000000
--- a/Tongue extraction_cropresizemethod/Tongue extraction/DeepTongue1.7.csproj
+++ /dev/null
@@ -1,187 +0,0 @@
-
-
-
-
-
- Debug
- AnyCPU
- {AFD610B1-8D23-423A-AA0F-B09BA769BDD7}
- WinExe
- Properties
- Tongue_extraction
- DeepTongue1.7
- v4.7.1
- 512
- true
-
-
-
- publish\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- true
- 0
- 1.0.0.%2a
- false
- false
- true
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
- true
- bin\x64\Debug\
- DEBUG;TRACE
- full
- x64
- prompt
- MinimumRecommendedRules.ruleset
- true
-
-
- bin\x64\Release\
- TRACE
- true
- pdbonly
- x64
- prompt
- MinimumRecommendedRules.ruleset
- true
-
-
- DeepTongue_Icon.ico
-
-
-
- Form
-
-
- Form1.cs
-
-
-
-
-
- Form1.cs
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
- Designer
-
-
- True
- Resources.resx
- True
-
-
-
- SettingsSingleFileGenerator
-
-
-
-
-
-
-
-
-
-
- False
- Microsoft .NET Framework 4.7.1 %28x86 および x64%29
- true
-
-
- False
- .NET Framework 3.5 SP1
- false
-
-
-
-
- False
- ..\..\..\packages\OpenCvSharp3-AnyCPU.3.2.0.20170107\lib\net40\OpenCvSharp.dll
-
-
- False
- ..\..\..\packages\OpenCvSharp3-AnyCPU.3.2.0.20170107\lib\net40\OpenCvSharp.Blob.dll
-
-
- False
- ..\..\..\packages\OpenCvSharp3-AnyCPU.3.2.0.20170107\lib\net40\OpenCvSharp.Extensions.dll
-
-
- ..\..\..\packages\OpenCvSharp3-AnyCPU.3.2.0.20170107\lib\net40\OpenCvSharp.UserInterface.dll
-
-
- C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.1\System.dll
-
-
- C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.1\System.ComponentModel.Composition.dll
-
-
- C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.1\System.ComponentModel.Composition.Registration.dll
-
-
- C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.1\System.ComponentModel.DataAnnotations.dll
-
-
-
-
-
-
-
-
-
- C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.1\System.Reflection.Context.dll
-
-
- ..\..\..\packages\System.ValueTuple.4.4.0\lib\net461\System.ValueTuple.dll
-
-
-
-
- False
- ..\..\..\packages\TensorFlowSharp.1.11.0\lib\net471\TensorFlowSharp.dll
-
-
-
-
-
- このプロジェクトは、このコンピューター上にない NuGet パッケージを参照しています。それらのパッケージをダウンロードするには、[NuGet パッケージの復元] を使用します。詳細については、http://go.microsoft.com/fwlink/?LinkID=322105 を参照してください。見つからないファイルは {0} です。
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Tongue extraction_cropresizemethod/Tongue extraction/DeepTongue2.0.csproj b/Tongue extraction_cropresizemethod/Tongue extraction/DeepTongue2.0.csproj
new file mode 100644
index 0000000..fa9f92b
--- /dev/null
+++ b/Tongue extraction_cropresizemethod/Tongue extraction/DeepTongue2.0.csproj
@@ -0,0 +1,187 @@
+
+
+
+
+
+ Debug
+ AnyCPU
+ {AFD610B1-8D23-423A-AA0F-B09BA769BDD7}
+ WinExe
+ Properties
+ Tongue_extraction
+ DeepTongue2.0
+ v4.7.1
+ 512
+ true
+
+
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+ true
+ bin\x64\Debug\
+ DEBUG;TRACE
+ full
+ x64
+ prompt
+ MinimumRecommendedRules.ruleset
+ true
+
+
+ bin\x64\Release\
+ TRACE
+ true
+ pdbonly
+ x64
+ prompt
+ MinimumRecommendedRules.ruleset
+ true
+
+
+ DeepTongue_Icon.ico
+
+
+
+ Form
+
+
+ Form1.cs
+
+
+
+
+
+ Form1.cs
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
+ True
+ Resources.resx
+ True
+
+
+
+ SettingsSingleFileGenerator
+
+
+
+
+
+
+
+
+
+
+ False
+ Microsoft .NET Framework 4.7.1 %28x86 および x64%29
+ true
+
+
+ False
+ .NET Framework 3.5 SP1
+ false
+
+
+
+
+ False
+ ..\..\..\packages\OpenCvSharp3-AnyCPU.3.2.0.20170107\lib\net40\OpenCvSharp.dll
+
+
+ False
+ ..\..\..\packages\OpenCvSharp3-AnyCPU.3.2.0.20170107\lib\net40\OpenCvSharp.Blob.dll
+
+
+ False
+ ..\..\..\packages\OpenCvSharp3-AnyCPU.3.2.0.20170107\lib\net40\OpenCvSharp.Extensions.dll
+
+
+ ..\..\..\packages\OpenCvSharp3-AnyCPU.3.2.0.20170107\lib\net40\OpenCvSharp.UserInterface.dll
+
+
+ C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.1\System.dll
+
+
+ C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.1\System.ComponentModel.Composition.dll
+
+
+ C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.1\System.ComponentModel.Composition.Registration.dll
+
+
+ C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.1\System.ComponentModel.DataAnnotations.dll
+
+
+
+
+
+
+
+
+
+ C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.1\System.Reflection.Context.dll
+
+
+ ..\..\..\packages\System.ValueTuple.4.4.0\lib\net461\System.ValueTuple.dll
+
+
+
+
+ False
+ ..\..\..\packages\TensorFlowSharp.1.11.0\lib\net471\TensorFlowSharp.dll
+
+
+
+
+
+ このプロジェクトは、このコンピューター上にない NuGet パッケージを参照しています。それらのパッケージをダウンロードするには、[NuGet パッケージの復元] を使用します。詳細については、http://go.microsoft.com/fwlink/?LinkID=322105 を参照してください。見つからないファイルは {0} です。
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Tongue extraction_cropresizemethod/Tongue extraction/Form1.Designer.cs b/Tongue extraction_cropresizemethod/Tongue extraction/Form1.Designer.cs
index 92cf792..a678399 100644
--- a/Tongue extraction_cropresizemethod/Tongue extraction/Form1.Designer.cs
+++ b/Tongue extraction_cropresizemethod/Tongue extraction/Form1.Designer.cs
@@ -179,10 +179,10 @@
//
// textBox1
//
- this.textBox1.Location = new System.Drawing.Point(196, 1);
+ this.textBox1.Location = new System.Drawing.Point(489, -1);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
- this.textBox1.Size = new System.Drawing.Size(562, 51);
+ this.textBox1.Size = new System.Drawing.Size(269, 51);
this.textBox1.TabIndex = 1;
this.textBox1.Visible = false;
//
@@ -279,7 +279,7 @@
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(246, 20);
this.label8.TabIndex = 14;
- this.label8.Text = "Contract (last input)";
+ this.label8.Text = "Gloss";
this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// pictureBox_output
@@ -383,7 +383,7 @@
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(1, 2, 1, 2);
this.Name = "Form1";
- this.Text = "DeepTongue1.7";
+ this.Text = "DeepTongue2.0";
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 72a0ae4..55c64d5 100644
--- a/Tongue extraction_cropresizemethod/Tongue extraction/Form1.cs
+++ b/Tongue extraction_cropresizemethod/Tongue extraction/Form1.cs
@@ -409,21 +409,12 @@
}
}
}
- if (check_detection == 1)
+
+ // 舌が検出されなかった場合,Detectionされた画像で学習したモデル(CropResize)を使用するのはまずいので
+ // 以前のモデル(Detectionせずに学習)を使用する
+ if (check_detection == 0)
{
- mat_drawBox.SaveImage(basepath + "\\detection" + imageFile);
- bitmap_bitch = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(mat_drawBox);
- Invoke((MethodInvoker)delegate
- {
- pictureBox_detection.Image = bitmap_bitch;
- pictureBox_detection.Refresh();
- });
- label1.BackColor = Color.White;
- label2.BackColor = Color.Red;
- }
- else // 舌が検出されなかった場合
- {
- MessageBox.Show("Error: Sorry can not detect any tongue in this image.\nPress [OK] to skip preprocessing.",
+ MessageBox.Show("Error: Sorry can not detect any tongue in this image.\nPress [OK] to skip preprocessing.",
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
time = DateTime.Now.ToLocalTime().ToString();
File.AppendAllText("DetectionFailedLog.txt ", time + " " + imageFile + "\n");
@@ -494,7 +485,7 @@
label1.BackColor = Color.White;
label4.BackColor = Color.Red;
});
-
+
mat_outputNoBox.SaveImage(basepath + "\\output256" + imageFile);
try
{
@@ -514,7 +505,7 @@
pictureBox_outputSRG.Refresh();
label4.BackColor = Color.White;
label5.BackColor = Color.Red;
- });
+ });
Cv2.Resize(mat_outputSRGNoBox, mat_mask, mat_input.Size());
mat_mask.SaveImage(basepath + "\\mask" + imageFile);
try
@@ -536,7 +527,7 @@
pictureBox_maskSRG.Refresh();
label5.BackColor = Color.White;
label6.BackColor = Color.Red;
- });
+ });
mat_extraction = mat_input.Clone();
int areaCount_noDetection = 0;
for (int i = 0; i < mat_input.Height; i++)
@@ -589,6 +580,17 @@
continue;
}
+
+ mat_drawBox.SaveImage(basepath + "\\detection" + imageFile);
+ bitmap_bitch = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(mat_drawBox);
+ Invoke((MethodInvoker)delegate
+ {
+ pictureBox_detection.Image = bitmap_bitch;
+ pictureBox_detection.Refresh();
+ });
+ label1.BackColor = Color.White;
+ label2.BackColor = Color.Red;
+ // 検出された場合の処理の続き
for (int i = P1.Y; i < P2.Y; i++)
{
for (int j = P1.X; j < P2.X; j++)
@@ -714,14 +716,24 @@
MessageBox.Show("Error: Unable to reprocess! Please check is there [RemoveSmallRegionDLL.dll] file in floder?", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
break;
}
+
mat_maskSRG = new Mat(basepath + "\\mask_changed2" + imageFile, ImreadModes.GrayScale);
Cv2.Threshold(mat_maskSRG, mat_maskSRG, 128, 255, ThresholdTypes.Binary);
bitmap_bitch = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(mat_maskSRG);
- Invoke((MethodInvoker)delegate
+ if(pictureBox_maskSRG.InvokeRequired)
+ {
+ pictureBox_maskSRG.Invoke((MethodInvoker)delegate
+ {
+ pictureBox_maskSRG.Image = bitmap_bitch;
+ pictureBox_maskSRG.Refresh();
+ });
+ }
+ else
{
pictureBox_maskSRG.Image = bitmap_bitch;
pictureBox_maskSRG.Refresh();
- });
+ }
+
label5.BackColor = Color.White;
label6.BackColor = Color.Red;
diff --git a/Tongue extraction_cropresizemethod/Tongue extraction/bin/x64/Debug/data/20180419045627.jpg b/Tongue extraction_cropresizemethod/Tongue extraction/bin/x64/Debug/data/20180419045627.jpg
deleted file mode 100644
index d7d3375..0000000
--- a/Tongue extraction_cropresizemethod/Tongue extraction/bin/x64/Debug/data/20180419045627.jpg
+++ /dev/null
Binary files differ
diff --git a/Tongue extraction_cropresizemethod/Tongue extraction/bin/x64/Release/data/20180419045627.jpg b/Tongue extraction_cropresizemethod/Tongue extraction/bin/x64/Release/data/20180419045627.jpg
deleted file mode 100644
index d7d3375..0000000
--- a/Tongue extraction_cropresizemethod/Tongue extraction/bin/x64/Release/data/20180419045627.jpg
+++ /dev/null
Binary files differ