C# と .NET でのガリシア語 OCR

This article was translated from English: Does it need improvement?
Translated
View the article in English
Other versions of this document:

*ガリシア語

IronOCR は、.NET 開発者がガリシア語を含む 126 の言語で画像や PDF ドキュメントからテキストを抽出できるようにする C# ソフトウェア コンポーネントです。

これは Tesseract の高度なフォークであり、.NET 開発者向けに特別に設計されており、速度と精度の両方で他の Tesseract エンジンを常に上回っています。

IronOcr.Languages.Galician の内容

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

  • ガリシア語
  • ガリシアベスト
  • ガリシアファースト

ダウンロード

ガリシア語言語パック[galego]

  • Zip形式でダウンロード
  • NuGetでインストール

インストール

.NET プロジェクトでガリシア語OCR パッケージを利用するための最初のステップは、それをインストールすることです。

Install-Package IronOCR.Languages.Galician

Code Example

次の C# コード例は、画像または PDF ドキュメントからガリシア語のテキストを読み取る方法を示しています。

// Include the IronOcr library
using IronOcr;

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

        // Specify the language for OCR as Galician
        Ocr.Language = OcrLanguage.Galician;

        // Define the input source, here it is an image file
        using (var Input = new OcrInput(@"images\Galician.png"))
        {
            // Perform the OCR process on the input image
            var Result = Ocr.Read(Input);

            // Retrieve the recognized text from the OCR result
            var AllText = Result.Text;

            // Output the extracted text to the console
            Console.WriteLine(AllText);
        }
    }
}
// Include the IronOcr library
using IronOcr;

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

        // Specify the language for OCR as Galician
        Ocr.Language = OcrLanguage.Galician;

        // Define the input source, here it is an image file
        using (var Input = new OcrInput(@"images\Galician.png"))
        {
            // Perform the OCR process on the input image
            var Result = Ocr.Read(Input);

            // Retrieve the recognized text from the OCR result
            var AllText = Result.Text;

            // Output the extracted text to the console
            Console.WriteLine(AllText);
        }
    }
}
' Include the IronOcr library
Imports IronOcr

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

		' Specify the language for OCR as Galician
		Ocr.Language = OcrLanguage.Galician

		' Define the input source, here it is an image file
		Using Input = New OcrInput("images\Galician.png")
			' Perform the OCR process on the input image
			Dim Result = Ocr.Read(Input)

			' Retrieve the recognized text from the OCR result
			Dim AllText = Result.Text

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

上記のコードでは:

  • IronTesseract クラスを使用して OCR エンジン オブジェクトを作成します。
  • OCR 言語をガリシア語に設定することで、OCR エンジンがガリシア語のテキストを正確に処理できるようになります。
  • 次に、"images\Galician.png"にある画像ファイルを読み取り、認識されたテキストを取得します。
  • 最後に、認識したテキストをコンソールに出力します。