Latin Alphabet OCR in C# and .NET
IronOCRは、.NETプログラマーがラテンアルファベットを含む126言語で画像やPDF文書からテキストを読み取れるC#のソフトウェアコンポーネントです。
これはTesseractの高度なフォークであり、.NET開発者専用に構築され、速度と精度の両方で他のTesseractエンジンを定期的に上回ります。
IronOcr.Languages.LatinAlphabetの内容
このパッケージには、.NET 用の64のOCR言語が含まれています:
- LatinAlphabet
- LatinAlphabetBest
- LatinAlphabetFast
ダウンロード
ラテンアルファベット言語パック [latine]
インストール
最初にやるべきことは、ラテンアルファベット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
説明
-
IronTesseract の初期化:
IronTesseractのインスタンスが初期化され、OCR処理を担当します。 -
言語設定: OCR言語は
LatinAlphabetに設定されており、IronOCRパッケージで利用可能な言語の一つです。 -
入力仕様: オブジェクト
OcrInputが作成され、テキストを抽出する画像またはPDFのパスを指定します。 -
OCR実行:
IronTesseractのインスタンスのReadメソッドを呼び出してOcrInputを処理します。 これは、抽出されたテキストを含むResultオブジェクトを返します。 -
テキスト抽出: 認識されたテキストにアクセスするために、
ResultオブジェクトのTextプロパティを使用します。 - 出力: 認識されたテキストは検証のためにコンソールに印刷されます。
ファイルパスが正しく画像またはPDFファイルを指していることを確認し、ファイルが見つからない例外を避けるために OcrInput に注意してください。

