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

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

  • イタリア語
  • イタリアンベスト
  • イタリアンファースト
  • イタリア語(古い)
  • イタリア語オールドベスト
  • イタリア語オールドファースト

ダウンロード

イタリア語言語パック[italiano]

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

インストール

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

Install-Package IronOCR.Languages.Italian

Code Example

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

// Include IronOcr library
using IronOcr;

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

        // Set the OCR language to Italian
        Ocr.Language = OcrLanguage.Italian;

        // Read text from an image file
        using (var Input = new OcrInput(@"images\Italian.png"))
        {
            // Perform OCR to get the text content from the image
            var Result = Ocr.Read(Input);

            // Get and print all the recognized text
            var AllText = Result.Text;
            Console.WriteLine(AllText);
        }
    }
}
// Include IronOcr library
using IronOcr;

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

        // Set the OCR language to Italian
        Ocr.Language = OcrLanguage.Italian;

        // Read text from an image file
        using (var Input = new OcrInput(@"images\Italian.png"))
        {
            // Perform OCR to get the text content from the image
            var Result = Ocr.Read(Input);

            // Get and print all the recognized text
            var AllText = Result.Text;
            Console.WriteLine(AllText);
        }
    }
}
' Include IronOcr library
Imports IronOcr

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

		' Set the OCR language to Italian
		Ocr.Language = OcrLanguage.Italian

		' Read text from an image file
		Using Input = New OcrInput("images\Italian.png")
			' Perform OCR to get the text content from the image
			Dim Result = Ocr.Read(Input)

			' Get and print all the recognized text
			Dim AllText = Result.Text
			Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel

説明:

  1. IronOCR の使用: OCR 機能を利用するためにIronOcrライブラリが含まれています。
  2. IronTesseract インスタンスの作成: IronTesseract 、OCR 処理に使用されるコア クラスです。 3.言語の設定: OCR は、 Ocr.Language = OcrLanguage.Italianを使用してイタリア語を処理するように設定されます。 4.入力の読み取り: 画像ファイルを指定するためにOcrInputオブジェクトが作成されます。
  3. OCR の実行: Ocr.Read(Input)は入力画像に対して OCR プロセスを実行し、テキスト結果を返します。 6.出力: 結果のテキストはAllTextに保存され、コンソールに表示されます。

この例が適切に動作するには、 images\Italian.pngファイルのパスが正しく、ファイルが存在することを確認してください。