Hangul Alphabet OCR in C# and .NET

This article was translated from English: Does it need improvement?
Translated
View the article in English

126 種其他語言

IronOCR 是一個 C# 軟體元件,讓 .NET 程式設計師能夠從 126 種語言的圖片和 PDF 文件中讀取文字,其中包括韓文。

這是 Tesseract 的進階分支版本,專為 .NET 開發人員打造,無論在速度或準確度方面,其表現均經常優於其他 Tesseract 引擎。

IronOcr.Languages.Hangul 的內容

此套件包含 156 種適用於 .NET 的 OCR 語言:

  • 韓文字母
  • 韓文字母Best
  • 韓文字母Fast
  • HangulVerticalAlphabet
  • HangulVerticalAlphabetBest
  • HangulVerticalAlphabetFast

下載

韓文字母語言套件 [韓文字母]

安裝

第一步是將 Hangul Alphabet OCR 套件安裝至您的 .NET 專案中。

Install-Package IronOcr.Languages.Hangul

程式碼範例

此 C# 程式碼範例會從圖片或 PDF 文件中讀取韓文字元。

// Ensure the IronOCR library is installed
// PM> Install-Package IronOcr.Languages.Hangul

using IronOcr;

class Program
{
    static void Main()
    {
        // Create a new instance of IronTesseract for performing OCR
        var Ocr = new IronTesseract();

        // Specify the Hangul language pack for better accuracy with Korean texts
        Ocr.Language = OcrLanguage.Hangul;

        // Load the image or PDF you want to read
        using (var Input = new OcrInput(@"images\Hangul.png"))
        {
            // Perform OCR to read the text from the image
            var Result = Ocr.Read(Input);

            // Extract the recognized text
            var AllText = Result.Text;

            // Output the text to the console
            Console.WriteLine(AllText);
        }
    }
}
// Ensure the IronOCR library is installed
// PM> Install-Package IronOcr.Languages.Hangul

using IronOcr;

class Program
{
    static void Main()
    {
        // Create a new instance of IronTesseract for performing OCR
        var Ocr = new IronTesseract();

        // Specify the Hangul language pack for better accuracy with Korean texts
        Ocr.Language = OcrLanguage.Hangul;

        // Load the image or PDF you want to read
        using (var Input = new OcrInput(@"images\Hangul.png"))
        {
            // Perform OCR to read the text from the image
            var Result = Ocr.Read(Input);

            // Extract the recognized text
            var AllText = Result.Text;

            // Output the text to the console
            Console.WriteLine(AllText);
        }
    }
}
' Ensure the IronOCR library is installed
' PM> Install-Package IronOcr.Languages.Hangul

Imports IronOcr

Friend Class Program
	Shared Sub Main()
		' Create a new instance of IronTesseract for performing OCR
		Dim Ocr = New IronTesseract()

		' Specify the Hangul language pack for better accuracy with Korean texts
		Ocr.Language = OcrLanguage.Hangul

		' Load the image or PDF you want to read
		Using Input = New OcrInput("images\Hangul.png")
			' Perform OCR to read the text from the image
			Dim Result = Ocr.Read(Input)

			' Extract the recognized text
			Dim AllText = Result.Text

			' Output the text to the console
			Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel

說明:

  • IronTesseract:這是用於執行 OCR 操作的主要類別。
  • OcrLanguage.Hangul:此設定指定 OCR 引擎應使用韓文語言套件,該套件可針對韓文文字辨識進行引擎優化。
  • OcrInput:這是用於存放待處理圖像或 PDF 檔案的容器。
  • Ocr.Read(): 此方法執行 OCR 操作,並傳回一個包含辨識文字的結果物件。