diff --git a/TessaractTest/TessaractTest.sln b/TessaractTest/TessaractTest.sln new file mode 100644 index 0000000..a998921 --- /dev/null +++ b/TessaractTest/TessaractTest.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32929.385 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TessaractTest", "TessaractTest\TessaractTest.csproj", "{18BB9C99-2707-4B65-B535-DED2B3EEC55E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {18BB9C99-2707-4B65-B535-DED2B3EEC55E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {18BB9C99-2707-4B65-B535-DED2B3EEC55E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {18BB9C99-2707-4B65-B535-DED2B3EEC55E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {18BB9C99-2707-4B65-B535-DED2B3EEC55E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {9B216018-EAF3-4280-AEBE-2C97FCD6DD6A} + EndGlobalSection +EndGlobal diff --git a/TessaractTest/TessaractTest/Form1.Designer.cs b/TessaractTest/TessaractTest/Form1.Designer.cs new file mode 100644 index 0000000..664fc8c --- /dev/null +++ b/TessaractTest/TessaractTest/Form1.Designer.cs @@ -0,0 +1,88 @@ +namespace TessaractTest +{ + 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.btnLoad = new System.Windows.Forms.Button(); + this.tbxMain = new System.Windows.Forms.TextBox(); + this.pbxMain = new System.Windows.Forms.PictureBox(); + ((System.ComponentModel.ISupportInitialize)(this.pbxMain)).BeginInit(); + this.SuspendLayout(); + // + // btnLoad + // + this.btnLoad.Location = new System.Drawing.Point(12, 12); + this.btnLoad.Name = "btnLoad"; + this.btnLoad.Size = new System.Drawing.Size(75, 23); + this.btnLoad.TabIndex = 0; + this.btnLoad.Text = "Load"; + this.btnLoad.UseVisualStyleBackColor = true; + this.btnLoad.Click += new System.EventHandler(this.btnLoad_Click); + // + // tbxMain + // + this.tbxMain.Location = new System.Drawing.Point(346, 41); + this.tbxMain.Multiline = true; + this.tbxMain.Name = "tbxMain"; + this.tbxMain.ReadOnly = true; + this.tbxMain.Size = new System.Drawing.Size(328, 356); + this.tbxMain.TabIndex = 1; + // + // pbxMain + // + this.pbxMain.Location = new System.Drawing.Point(12, 41); + this.pbxMain.Name = "pbxMain"; + this.pbxMain.Size = new System.Drawing.Size(328, 356); + this.pbxMain.TabIndex = 2; + this.pbxMain.TabStop = false; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(683, 406); + this.Controls.Add(this.pbxMain); + this.Controls.Add(this.tbxMain); + this.Controls.Add(this.btnLoad); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "Form1"; + this.Text = "Form1"; + ((System.ComponentModel.ISupportInitialize)(this.pbxMain)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private Button btnLoad; + private TextBox tbxMain; + private PictureBox pbxMain; + } +} \ No newline at end of file diff --git a/TessaractTest/TessaractTest/Form1.cs b/TessaractTest/TessaractTest/Form1.cs new file mode 100644 index 0000000..1a45640 --- /dev/null +++ b/TessaractTest/TessaractTest/Form1.cs @@ -0,0 +1,29 @@ +using Tesseract; + +namespace TessaractTest +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + + private void btnLoad_Click(object sender, EventArgs e) + { + OpenFileDialog dlg = new OpenFileDialog(); + if (dlg.ShowDialog() != DialogResult.OK) + return; + + string filePath = dlg.FileName; + pbxMain.Load(filePath); + pbxMain.SizeMode = PictureBoxSizeMode.Zoom; + + Pix pix = Pix.LoadFromFile(filePath); + TesseractEngine ocr = new TesseractEngine("./tessdata", "kor", EngineMode.Default); + Page page = ocr.Process(pix); + + tbxMain.Text = page.GetText(); + } + } +} \ No newline at end of file diff --git a/TessaractTest/TessaractTest/Form1.resx b/TessaractTest/TessaractTest/Form1.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/TessaractTest/TessaractTest/Form1.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/TessaractTest/TessaractTest/Program.cs b/TessaractTest/TessaractTest/Program.cs new file mode 100644 index 0000000..211abd2 --- /dev/null +++ b/TessaractTest/TessaractTest/Program.cs @@ -0,0 +1,17 @@ +namespace TessaractTest +{ + internal static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + // To customize application configuration such as set high DPI settings or default font, + // see https://aka.ms/applicationconfiguration. + ApplicationConfiguration.Initialize(); + Application.Run(new Form1()); + } + } +} \ No newline at end of file diff --git a/TessaractTest/TessaractTest/TessaractTest.csproj b/TessaractTest/TessaractTest/TessaractTest.csproj new file mode 100644 index 0000000..55bf929 --- /dev/null +++ b/TessaractTest/TessaractTest/TessaractTest.csproj @@ -0,0 +1,19 @@ + + + + WinExe + net6.0-windows + enable + true + enable + + + + + + + + + + + \ No newline at end of file diff --git a/TessaractTest/TessaractTest/tessdata/eng.traineddata b/TessaractTest/TessaractTest/tessdata/eng.traineddata new file mode 100644 index 0000000..f4744c2 Binary files /dev/null and b/TessaractTest/TessaractTest/tessdata/eng.traineddata differ diff --git a/TessaractTest/TessaractTest/tessdata/kor.traineddata b/TessaractTest/TessaractTest/tessdata/kor.traineddata new file mode 100644 index 0000000..cc689b2 Binary files /dev/null and b/TessaractTest/TessaractTest/tessdata/kor.traineddata differ diff --git a/TessaractTest/TessaractTest/tessdata/kor_vert.traineddata b/TessaractTest/TessaractTest/tessdata/kor_vert.traineddata new file mode 100644 index 0000000..016065c Binary files /dev/null and b/TessaractTest/TessaractTest/tessdata/kor_vert.traineddata differ