diff --git a/Tongue extraction_cropresizemethod/ColorSubdivision/ColorSubdivision.csproj b/Tongue extraction_cropresizemethod/ColorSubdivision/ColorSubdivision.csproj new file mode 100644 index 0000000..9f1ebea --- /dev/null +++ b/Tongue extraction_cropresizemethod/ColorSubdivision/ColorSubdivision.csproj @@ -0,0 +1,151 @@ + + + + + Debug + AnyCPU + {AD42A573-7AC3-4714-9D53-DB9921815CBB} + WinExe + ColorSubdivision + ColorSubdivision + v4.7.1 + 512 + true + true + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + x64 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + x64 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + true + bin\x64\Debug\ + DEBUG;TRACE + full + x64 + 7.3 + prompt + MinimumRecommendedRules.ruleset + true + + + bin\x64\Release\ + TRACE + true + pdbonly + x64 + 7.3 + prompt + MinimumRecommendedRules.ruleset + true + + + + ..\..\..\..\..\..\system\sdk\OpenCVsharp\net461\OpenCvSharp.dll + + + ..\..\..\..\..\..\system\sdk\OpenCVsharp\net461\OpenCvSharp.Blob.dll + + + ..\..\..\..\..\..\system\sdk\OpenCVsharp\net461\OpenCvSharp.Extensions.dll + + + ..\..\..\..\..\..\system\sdk\OpenCVsharp\net461\OpenCvSharp.UserInterface.dll + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + Always + + + + + False + Microsoft .NET Framework 4.7.1 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + + + \ No newline at end of file diff --git a/Tongue extraction_cropresizemethod/ColorSubdivision/Form1.Designer.cs b/Tongue extraction_cropresizemethod/ColorSubdivision/Form1.Designer.cs new file mode 100644 index 0000000..1b0e6fd --- /dev/null +++ b/Tongue extraction_cropresizemethod/ColorSubdivision/Form1.Designer.cs @@ -0,0 +1,84 @@ +namespace ColorSubdivision +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.RichTextBox1 = new System.Windows.Forms.RichTextBox(); + this.SuspendLayout(); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(115, 47); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 0; + this.button1.Text = "Button1"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.Button1_Click); + // + // button2 + // + this.button2.Location = new System.Drawing.Point(115, 105); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(75, 23); + this.button2.TabIndex = 1; + this.button2.Text = "Button2"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.Button2_Click); + // + // RichTextBox1 + // + this.RichTextBox1.Location = new System.Drawing.Point(370, 138); + this.RichTextBox1.Name = "RichTextBox1"; + this.RichTextBox1.Size = new System.Drawing.Size(100, 96); + this.RichTextBox1.TabIndex = 2; + this.RichTextBox1.Text = ""; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.RichTextBox1); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Name = "Form1"; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.RichTextBox RichTextBox1; + } +} + diff --git a/Tongue extraction_cropresizemethod/ColorSubdivision/Form1.cs b/Tongue extraction_cropresizemethod/ColorSubdivision/Form1.cs new file mode 100644 index 0000000..9d64c49 --- /dev/null +++ b/Tongue extraction_cropresizemethod/ColorSubdivision/Form1.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using OpenCvSharp; + +namespace ColorSubdivision +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + + private void Button1_Click(object sender, EventArgs e) + { + var path = @"D:\kei2\Solutions\DeepTongue\LocalRepository\Tongue extraction_cropresizemethod\Tongue extraction\bin\x64\Debug\mask_final\20180315093610.jpg"; + using (Mat mat_input = Cv2.ImRead(path, ImreadModes.Grayscale)) + { + var mat_dst = new Mat(mat_input.Size(), mat_input.Type()); + bool isEdge = false; + for (int i = 0; i < mat_input.Height; i++) + { + if(!isEdge) + { + for (int j = 0; j < mat_input.Width; j++) + { + if (mat_input.At(i, j) > 200) + { + mat_dst.Set(i, j, 100); + isEdge = true; + } + } + } + } + Cv2.ImShow("input", mat_input); + Cv2.ImShow("dst", mat_dst); + mat_dst.Dispose(); + } + GC.Collect(); + + } + + private void Button2_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/Tongue extraction_cropresizemethod/ColorSubdivision/Form1.resx b/Tongue extraction_cropresizemethod/ColorSubdivision/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Tongue extraction_cropresizemethod/ColorSubdivision/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Tongue extraction_cropresizemethod/ColorSubdivision/Program.cs b/Tongue extraction_cropresizemethod/ColorSubdivision/Program.cs new file mode 100644 index 0000000..b7233a7 --- /dev/null +++ b/Tongue extraction_cropresizemethod/ColorSubdivision/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ColorSubdivision +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Tongue extraction_cropresizemethod/ColorSubdivision/Properties/AssemblyInfo.cs b/Tongue extraction_cropresizemethod/ColorSubdivision/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..87b468f --- /dev/null +++ b/Tongue extraction_cropresizemethod/ColorSubdivision/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ColorSubdivision")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ColorSubdivision")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("ad42a573-7ac3-4714-9d53-db9921815cbb")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tongue extraction_cropresizemethod/ColorSubdivision/Properties/Resources.Designer.cs b/Tongue extraction_cropresizemethod/ColorSubdivision/Properties/Resources.Designer.cs new file mode 100644 index 0000000..6ca7260 --- /dev/null +++ b/Tongue extraction_cropresizemethod/ColorSubdivision/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace ColorSubdivision.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ColorSubdivision.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Tongue extraction_cropresizemethod/ColorSubdivision/Properties/Resources.resx b/Tongue extraction_cropresizemethod/ColorSubdivision/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Tongue extraction_cropresizemethod/ColorSubdivision/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Tongue extraction_cropresizemethod/ColorSubdivision/Properties/Settings.Designer.cs b/Tongue extraction_cropresizemethod/ColorSubdivision/Properties/Settings.Designer.cs new file mode 100644 index 0000000..41f48bd --- /dev/null +++ b/Tongue extraction_cropresizemethod/ColorSubdivision/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace ColorSubdivision.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.5.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/Tongue extraction_cropresizemethod/ColorSubdivision/Properties/Settings.settings b/Tongue extraction_cropresizemethod/ColorSubdivision/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Tongue extraction_cropresizemethod/ColorSubdivision/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Tongue extraction_cropresizemethod/Tongue extraction.sln b/Tongue extraction_cropresizemethod/Tongue extraction.sln index ad4d396..81c772d 100644 --- a/Tongue extraction_cropresizemethod/Tongue extraction.sln +++ b/Tongue extraction_cropresizemethod/Tongue extraction.sln @@ -5,22 +5,41 @@ MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeepTIAS1.9", "Tongue extraction\DeepTIAS1.9.csproj", "{AFD610B1-8D23-423A-AA0F-B09BA769BDD7}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ColorSubdivision", "ColorSubdivision\ColorSubdivision.csproj", "{AD42A573-7AC3-4714-9D53-DB9921815CBB}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {AFD610B1-8D23-423A-AA0F-B09BA769BDD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AFD610B1-8D23-423A-AA0F-B09BA769BDD7}.Debug|Any CPU.Build.0 = Debug|Any CPU {AFD610B1-8D23-423A-AA0F-B09BA769BDD7}.Debug|x64.ActiveCfg = Debug|x64 - {AFD610B1-8D23-423A-AA0F-B09BA769BDD7}.Debug|x64.Build.0 = Debug|x64 + {AFD610B1-8D23-423A-AA0F-B09BA769BDD7}.Debug|x86.ActiveCfg = Debug|x64 + {AFD610B1-8D23-423A-AA0F-B09BA769BDD7}.Debug|x86.Build.0 = Debug|x64 {AFD610B1-8D23-423A-AA0F-B09BA769BDD7}.Release|Any CPU.ActiveCfg = Release|Any CPU {AFD610B1-8D23-423A-AA0F-B09BA769BDD7}.Release|Any CPU.Build.0 = Release|Any CPU {AFD610B1-8D23-423A-AA0F-B09BA769BDD7}.Release|x64.ActiveCfg = Release|x64 {AFD610B1-8D23-423A-AA0F-B09BA769BDD7}.Release|x64.Build.0 = Release|x64 + {AFD610B1-8D23-423A-AA0F-B09BA769BDD7}.Release|x86.ActiveCfg = Release|Any CPU + {AFD610B1-8D23-423A-AA0F-B09BA769BDD7}.Release|x86.Build.0 = Release|Any CPU + {AD42A573-7AC3-4714-9D53-DB9921815CBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AD42A573-7AC3-4714-9D53-DB9921815CBB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AD42A573-7AC3-4714-9D53-DB9921815CBB}.Debug|x64.ActiveCfg = Debug|x64 + {AD42A573-7AC3-4714-9D53-DB9921815CBB}.Debug|x64.Build.0 = Debug|x64 + {AD42A573-7AC3-4714-9D53-DB9921815CBB}.Debug|x86.ActiveCfg = Debug|Any CPU + {AD42A573-7AC3-4714-9D53-DB9921815CBB}.Debug|x86.Build.0 = Debug|Any CPU + {AD42A573-7AC3-4714-9D53-DB9921815CBB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AD42A573-7AC3-4714-9D53-DB9921815CBB}.Release|Any CPU.Build.0 = Release|Any CPU + {AD42A573-7AC3-4714-9D53-DB9921815CBB}.Release|x64.ActiveCfg = Release|Any CPU + {AD42A573-7AC3-4714-9D53-DB9921815CBB}.Release|x64.Build.0 = Release|Any CPU + {AD42A573-7AC3-4714-9D53-DB9921815CBB}.Release|x86.ActiveCfg = Release|Any CPU + {AD42A573-7AC3-4714-9D53-DB9921815CBB}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Tongue extraction_cropresizemethod/Tongue extraction/DeepTIAS1.9.csproj b/Tongue extraction_cropresizemethod/Tongue extraction/DeepTIAS1.9.csproj index c0bb69c..dae0f1c 100644 --- a/Tongue extraction_cropresizemethod/Tongue extraction/DeepTIAS1.9.csproj +++ b/Tongue extraction_cropresizemethod/Tongue extraction/DeepTIAS1.9.csproj @@ -107,6 +107,9 @@ + + Always + diff --git a/Tongue extraction_cropresizemethod/Tongue extraction/Form1.cs b/Tongue extraction_cropresizemethod/Tongue extraction/Form1.cs index b27fd7e..6192e82 100644 --- a/Tongue extraction_cropresizemethod/Tongue extraction/Form1.cs +++ b/Tongue extraction_cropresizemethod/Tongue extraction/Form1.cs @@ -718,6 +718,7 @@ } } } + GC.Collect(); Thread.Sleep(1000); bitmap_bitch = ToGrayBitmap(mask, 256, 256); mat_output = OpenCvSharp.Extensions.BitmapConverter.ToMat(bitmap_bitch);