Latin Alphabet OCR in C# and .NET

This article was translated from English: Does it need improvement?
Translated
View the article in English

他126の言語

IronOCRは、.NETプログラマーがラテンアルファベットを含む126言語で画像やPDF文書からテキストを読み取れるC#のソフトウェアコンポーネントです。

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

IronOcr.Languages.LatinAlphabetの内容

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

  • LatinAlphabet
  • LatinAlphabetBest
  • LatinAlphabetFast

ダウンロード

ラテンアルファベット言語パック [latine]

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

インストール

最初にやるべきことは、ラテンアルファベットOCRパッケージをあなた for .NETプロジェクトにインストールすることです。

Install-Package IronOcr.Languages.LatinAlphabet

Code Example

このC#コード例は、画像またはPDF文書からラテンアルファベットのテキストを読み取ります。

// Install the IronOCR.languages.LatinAlphabet package first
using IronOcr;

var Ocr = new IronTesseract(); // Initialize IronTesseract instance

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

// Define the input image or PDF you want to read
using (var Input = new OcrInput(@"images\LatinAlphabet.png"))
{
    // Perform OCR reading on the input
    var Result = Ocr.Read(Input);

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

    // Output the recognized text
    Console.WriteLine(AllText);
}
// Install the IronOCR.languages.LatinAlphabet package first
using IronOcr;

var Ocr = new IronTesseract(); // Initialize IronTesseract instance

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

// Define the input image or PDF you want to read
using (var Input = new OcrInput(@"images\LatinAlphabet.png"))
{
    // Perform OCR reading on the input
    var Result = Ocr.Read(Input);

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

    // Output the recognized text
    Console.WriteLine(AllText);
}
' Install the IronOCR.languages.LatinAlphabet package first
Imports IronOcr

Private Ocr = New IronTesseract() ' Initialize IronTesseract instance

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

' Define the input image or PDF you want to read
Using Input = New OcrInput("images\LatinAlphabet.png")
	' Perform OCR reading on the input
	Dim Result = Ocr.Read(Input)

	' Extract the recognized text
	Dim AllText = Result.Text

	' Output the recognized text
	Console.WriteLine(AllText)
End Using
$vbLabelText   $csharpLabel

説明

  1. IronTesseract の初期化:OCR 処理を処理する IronTesseract のインスタンスが初期化されます。

  2. 言語設定: OCRの言語はLatinAlphabetに設定されています。これはIronOCRパッケージで利用可能な言語の一つです。

  3. 入力仕様:OcrInputオブジェクトが作成され、テキストが抽出される画像またはPDFへのパスが指定されます。

  4. OCRの実行:OcrInputを処理します。 これにより、抽出されたテキストを含む Result オブジェクトが返されます。

  5. テキストの抽出: Text オブジェクトの Result プロパティを使用して、認識されたテキストにアクセスします。

  6. 出力: 認識されたテキストは検証のためにコンソールに印刷されます。

ファイルが見つからないという例外が発生しないよう、OcrInput内のファイルパスが、画像またはPDFファイルを正しく指していることを確認してください。