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.Serbian の内容

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

  • セルビア語
  • セルビア語ベスト
  • セルビアファースト
  • セルビア語Latin
  • セルビア語ラテン語ベスト
  • セルビア語LatinFast

ダウンロード

セルビア語言語パック[セルビア語]

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

インストール

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

Install-Package IronOcr.Languages.Serbian

Code Example

この C# コード例は、画像または PDF ドキュメントからセルビア語のテキストを読み取ります。

// Ensure all necessary namespaces are imported
using IronOcr;

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

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

        // Use a using statement to ensure resources are disposed properly
        using (var Input = new OcrInput(@"images\Serbian.png"))
        {
            // Perform OCR and store the result
            var Result = Ocr.Read(Input);

            // Extract all text from the OCR result
            var AllText = Result.Text;

            // Output the resulting text
            Console.WriteLine(AllText);
        }
    }
}
// Ensure all necessary namespaces are imported
using IronOcr;

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

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

        // Use a using statement to ensure resources are disposed properly
        using (var Input = new OcrInput(@"images\Serbian.png"))
        {
            // Perform OCR and store the result
            var Result = Ocr.Read(Input);

            // Extract all text from the OCR result
            var AllText = Result.Text;

            // Output the resulting text
            Console.WriteLine(AllText);
        }
    }
}
' Ensure all necessary namespaces are imported
Imports IronOcr

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

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

		' Use a using statement to ensure resources are disposed properly
		Using Input = New OcrInput("images\Serbian.png")
			' Perform OCR and store the result
			Dim Result = Ocr.Read(Input)

			' Extract all text from the OCR result
			Dim AllText = Result.Text

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

コードの説明:

  • OCR を実行するために使用されるIronTesseractの新しいインスタンスを初期化します。
  • OCR エンジンの言語は、 OcrLanguage.Serbianを使用してセルビア語に設定されています。
  • 指定されたパスからファイルを読み取るOcrInputを使用して、イメージSerbian.pngをロードします。
  • OCR オブジェクトでRead関数が呼び出され、画像を処理してテキストを抽出します。
  • 画像から抽出されたテキストは変数AllTextに保存され、コンソールに出力されます。