Han Simplified Alphabet OCR in C# and .NET

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

他126の言語

IronOCR は、.NET コーダーが簡体字漢字を含む 126 の言語で画像や PDF ドキュメントからテキストを読み取ることができる C# ソフトウェア コンポーネントです。

これはTesseractの高度なフォークであり、.NET開発者専用に構築され、速度と精度の両方で他のTesseractエンジンを定期的に上回ります。

IronOcr.Languages.Han の内容

このパッケージには、.NET 用の 400 の OCR 言語が含まれています。

  • HanSimplifiedAlphabet
  • HanSimplifiedAlphabetBest
  • HanSimplifiedAlphabetFast
  • HanSimplifiedVerticalAlphabet
  • HanSimplifiedVerticalAlphabetBest
  • HanSimplifiedVerticalAlphabetFast
  • HanTraditionalAlphabet
  • HanTraditionalAlphabetBest
  • HanTraditionalAlphabetFast
  • HanTraditionalVerticalAlphabet
  • HanTraditionalVerticalAlphabetBest
  • ハングル 繁体字 縦書き アルファベット 高速

ダウンロード

簡体字漢字言語パック [Samhan]

  • Download as Zip
  • NuGetでインストール

インストール

最初に、Han Simplified Alphabet OCR パッケージを .NET プロジェクトにインストールする必要があります。

パッケージ マネージャー コンソールで次のコマンドを実行します。

Install-Package IronOcr.Languages.Han

Code Example

この C# コード例は、画像または PDF ドキュメントから Han Simplified Alphabet のテキストを読み取ります。

// Reference the IronOcr library
using IronOcr;

class Program
{
    static void Main()
    {
        // Create an IronTesseract OCR engine
        var Ocr = new IronTesseract();

        // Load the Han language for OCR processing
        Ocr.Language = OcrLanguage.Han;

        // Using a 'using' statement for resource management
        using (var Input = new OcrInput(@"images\Han.png"))
        {
            // Process the image to extract text
            var Result = Ocr.Read(Input);

            // Retrieve and display the extracted text
            string AllText = Result.Text;
            System.Console.WriteLine(AllText);
        }
    }
}
// Reference the IronOcr library
using IronOcr;

class Program
{
    static void Main()
    {
        // Create an IronTesseract OCR engine
        var Ocr = new IronTesseract();

        // Load the Han language for OCR processing
        Ocr.Language = OcrLanguage.Han;

        // Using a 'using' statement for resource management
        using (var Input = new OcrInput(@"images\Han.png"))
        {
            // Process the image to extract text
            var Result = Ocr.Read(Input);

            // Retrieve and display the extracted text
            string AllText = Result.Text;
            System.Console.WriteLine(AllText);
        }
    }
}
' Reference the IronOcr library
Imports IronOcr

Friend Class Program
	Shared Sub Main()
		' Create an IronTesseract OCR engine
		Dim Ocr = New IronTesseract()

		' Load the Han language for OCR processing
		Ocr.Language = OcrLanguage.Han

		' Using a 'using' statement for resource management
		Using Input = New OcrInput("images\Han.png")
			' Process the image to extract text
			Dim Result = Ocr.Read(Input)

			' Retrieve and display the extracted text
			Dim AllText As String = Result.Text
			System.Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel

説明

  • IronOCRライブラリを参照して、そのOCR機能を使用することから始めます。
  • 画像やPDFドキュメントを処理するためのIronTesseractのインスタンスを作成します。
  • OCRプロセスの言語はHanに設定されます。
  • Ocr.Read()を呼び出して処理します。
  • OCRプロセスの結果はResult.Textに保存され、これはドキュメントから抽出されたテキストを含んでいます。
  • 最後に、テキストをコンソールに出力します。

適切なusingステートメントで効率的にリソースを管理してください。