Italian OCR in C# and .NET

This article was translated from English: Does it need improvement?
Translated
View the article in English
このドキュメントの他のバージョン:

*イタリア語

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

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

IronOcr.Languages.Italian の内容

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

  • イタリア語
  • イタリア語Best
  • イタリア語Fast
  • イタリア語(旧)
  • イタリア語(旧)Best
  • イタリア語オールドファースト

ダウンロード

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

インストール

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

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