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# ソフトウェア コンポーネントです。 これは、特に.NET開発者向けに構築されたTesseractの高度なフォークであり、速度と精度の両方で他のTesseractエンジンを定期的に上回ります。

IronOcr.Languages.Welsh の内容

このパッケージには、.NET 用のウェールズ語 OCR 言語の 3 つのバージョンが含まれています。

  • ウェールズ語
  • ウェールズベスト
  • ウェルシュファスト

ダウンロード

ウェールズ語言語パック[ウェールズ語]

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

インストール

最初のステップは、.NET プロジェクトにウェールズ語OCR パッケージをインストールすることです。

Install-Package IronOCR.Languages.Welsh

Code Example

この C# コード例は、画像または PDF ドキュメントからウェールズ語のテキストを読み取る方法を示しています。

// Import the IronOcr namespace
using IronOcr;

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

        // Set the language to Welsh
        Ocr.Language = OcrLanguage.Welsh;

        // Read text from the given image
        using (var Input = new OcrInput(@"images\Welsh.png"))
        {
            // Perform OCR and get the result
            var Result = Ocr.Read(Input);

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

            // Output text to the console
            Console.WriteLine(AllText);
        }
    }
}
// Import the IronOcr namespace
using IronOcr;

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

        // Set the language to Welsh
        Ocr.Language = OcrLanguage.Welsh;

        // Read text from the given image
        using (var Input = new OcrInput(@"images\Welsh.png"))
        {
            // Perform OCR and get the result
            var Result = Ocr.Read(Input);

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

            // Output text to the console
            Console.WriteLine(AllText);
        }
    }
}
' Import the IronOcr namespace
Imports IronOcr

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

		' Set the language to Welsh
		Ocr.Language = OcrLanguage.Welsh

		' Read text from the given image
		Using Input = New OcrInput("images\Welsh.png")
			' Perform OCR and get the result
			Dim Result = Ocr.Read(Input)

			' Extract all recognized text
			Dim AllText = Result.Text

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

このコードでは:

  • まず、 IronOcr名前空間を使用して OCR 機能にアクセスします。
  • OCR 操作を実行するために IronOCR によって提供されるメイン クラスであるIronTesseractのインスタンスを作成します。
  • OCR 言語は、 Ocr.Language = OcrLanguage.Welshを使用してウェールズ語に設定されています。
  • OCR 処理のために、 imagesディレクトリにあるWelsh.pngという名前の画像ファイルを開きます。
  • 最後に、 Ocr.Read(Input)メソッドは画像からテキストを読み取り、抽出されたテキストはAllTextに保存されます。
  • 認識されたウェールズ語のテキストがコンソールに出力されます。