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 の初期化: IronTesseract のインスタンスが初期化され、OCR処理を担当します。

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

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

  4. OCR実行: IronTesseract のインスタンスの Read メソッドを呼び出して OcrInput を処理します。 これは、抽出されたテキストを含む Result オブジェクトを返します。

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

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

ファイルパスが正しく画像またはPDFファイルを指していることを確認し、ファイルが見つからない例外を避けるために OcrInput に注意してください。