
IronOCRとAsprise OCRの比較
Tesseract OCRはテキスト抽出前にPDFページを画像に変換する必要がありますが、 IronOCRは.NETでPDFドキュメントをネイティブに読み取ります。 スキャンされた文書を大規模に処理するC#アプリケーションの場合、このアーキテクチャの違いが、セットアップの複雑さ、コード量、および本番環境における信頼性を左右します。
スキャンしたPDF文書からテキストを抽出することは、C#および.NET 10アプリケーションにおいて一般的な要件です。 請求書の処理、紙の記録のデジタル化、データ入力ワークフローの自動化など、開発者はPDFファイルを効率的に編集可能で検索可能なデータに変換する信頼性の高いOCRソリューションを必要としています。 Tesseract OCRは、Googleがメンテナンスしている広く利用されているオープンソースの光学文字認識エンジンですが、 .NET開発者は、特にPDFコンテンツに適用する際に、しばしば問題に直面します。
この比較では、C# でPDF からテキストへの変換を行う際に、Tesseract とIronOCR をどのように使用するかを検証し、コード例と、実運用システムに適したライブラリを選択するための実践的なガイダンスを提供します。
TesseractとIronOCRのどちらを選ぶべきか、迅速な判断基準は何ですか?
予算の制約から無料のソリューションが必要な場合、入力が画像ファイルのみの場合、そしてチームに追加のセットアップや依存関係の作業を行う余裕がある場合は、 Tesseractを選択してください。
PDF文書やスキャンファイルが主な入力データである場合、開発速度が重要な場合、または依存関係のトラブルシューティングなしにAzure、Docker、Linuxへのクロスプラットフォーム展開が必要な場合は、 IronOCRを選択してください。
| 基準 | Tesseract | IronOCR |
|---|---|---|
| コスト | 無料(Apache 2.0) | 商業ライセンスが必要です |
| PDF入力 | 画像変換が必要です | ネイティブサポート |
| セットアップの複雑さ | 高(複数の依存関係あり) | 単一のNuGetパッケージ |
| クロスプラットフォーム | 設定が必要です | Windows、macOS、Linux |
| 画像前処理 | マニュアル | 内蔵フィルター |
| 制作サポート | コミュニティ限定 | 商用サポート |
これらのOCRソリューションは、機能ごとにどのように比較できるのでしょうか?
実装の詳細に入る前に、スキャンしたPDFファイルからのテキスト認識における主要な機能について、比較表を以下に示します。
| 機能 | テッセラクト | IronOCR |
|---|---|---|
| ネイティブPDF入力 | いいえ(画像変換が必要です) | はい |
| インストール | 複数の依存関係 | 単一のNuGetパッケージ |
| パスワードで保護されたPDF | サポートされていません | サポート対象 |
| 画像の前処理 | マニュアル(外部ツール) | 内蔵フィルター |
| 対応言語 | 100以上の言語 | 127以上の言語 |
| ライセンス | アパッチ2.0(無料) | 商用 |
| .NET 統合 | ラッパーライブラリ経由 | ネイティブC#ライブラリ |
| 画像フォーマット | png、jpeg、tiff、bmp | PNG、JPEG、TIFF、BMP、GIF、PDF |
| 出力オプション | プレーンテキスト、hOCR、HTML | プレーンテキスト、検索可能なPDF、hOCR |
IronOCRは、特に検索可能なPDF生成やバーコード認識を必要とするEnterprise文書管理において、より包括的なPDF処理機能を提供します。
TesseractはどのようにPDFファイルを扱い、テキストを抽出しますか?
Tesseract OCRエンジンは、PDFドキュメントの入力をネイティブサポートしていません。 Tesseractの公式ドキュメントによると、開発者はOCRを実行する前にPDFページをPNGまたはJPEG画像に変換する必要がある。 このプロセスでは、各ページを変換するためにGhostscriptや専用のPDFレンダリングライブラリなどの追加ライブラリが必要となり、本番環境のパイプラインに複雑さと障害発生箇所が増える。
以下は、C# で PDF からテキストを抽出する標準的な Tesseract ワークフローの簡略化された例です。
using Tesseract;
// Step 1: Convert PDF page to PNG (requires a separate PDF rendering library)
// This example assumes the scanned PDF has already been converted to an image
string imagePath = "document-scan.png";
// Step 2: Initialize Tesseract with the language data path
using var engine = new TesseractEngine(@"./tessdata", "eng", EngineMode.Default);
// Step 3: Load the image and run OCR
using var img = Pix.LoadFromFile(imagePath);
using var page = engine.Process(img);
// Step 4: Extract recognized text
string extractedText = page.GetText();
Console.WriteLine($"Confidence: {page.GetMeanConfidence()}");
Console.WriteLine(extractedText);
// Optional: retrieve word-level bounding boxes
using var iter = page.GetIterator();
iter.Begin();
do
{
if (iter.TryGetBoundingBox(PageIteratorLevel.Word, out var bounds))
{
string word = iter.GetText(PageIteratorLevel.Word);
Console.WriteLine($"Word: {word} at {bounds}");
}
} while (iter.Next(PageIteratorLevel.Word));Imports Tesseract
' Step 1: Convert PDF page to PNG (requires a separate PDF rendering library)
' This example assumes the scanned PDF has already been converted to an image
Dim imagePath As String = "document-scan.png"
' Step 2: Initialize Tesseract with the language data path
Using engine As New TesseractEngine("./tessdata", "eng", EngineMode.Default)
' Step 3: Load the image and run OCR
Using img As Pix = Pix.LoadFromFile(imagePath)
Using page As Page = engine.Process(img)
' Step 4: Extract recognized text
Dim extractedText As String = page.GetText()
Console.WriteLine($"Confidence: {page.GetMeanConfidence()}")
Console.WriteLine(extractedText)
' Optional: retrieve word-level bounding boxes
Using iter As ResultIterator = page.GetIterator()
iter.Begin()
Do
Dim bounds As Rect
If iter.TryGetBoundingBox(PageIteratorLevel.Word, bounds) Then
Dim word As String = iter.GetText(PageIteratorLevel.Word)
Console.WriteLine($"Word: {word} at {bounds}")
End If
Loop While iter.Next(PageIteratorLevel.Word)
End Using
End Using
End Using
End UsingImports Tesseract
' Step 1: Convert PDF page to PNG (requires a separate PDF rendering library)
' This example assumes the scanned PDF has already been converted to an image
Dim imagePath As String = "document-scan.png"
' Step 2: Initialize Tesseract with the language data path
Using engine As New TesseractEngine("./tessdata", "eng", EngineMode.Default)
' Step 3: Load the image and run OCR
Using img As Pix = Pix.LoadFromFile(imagePath)
Using page As Page = engine.Process(img)
' Step 4: Extract recognized text
Dim extractedText As String = page.GetText()
Console.WriteLine($"Confidence: {page.GetMeanConfidence()}")
Console.WriteLine(extractedText)
' Optional: retrieve word-level bounding boxes
Using iter As ResultIterator = page.GetIterator()
iter.Begin()
Do
Dim bounds As Rect
If iter.TryGetBoundingBox(PageIteratorLevel.Word, bounds) Then
Dim word As String = iter.GetText(PageIteratorLevel.Word)
Console.WriteLine($"Word: {word} at {bounds}")
End If
Loop While iter.Next(PageIteratorLevel.Word)
End Using
End Using
End Using
End Usingこのコードは、NuGetで利用可能な.NETラッパーを使用した標準的なTesseractのアプローチを示しています。 tessdataフォルダへのパスが必要です。これらはtessdataリポジトリから別途ダウンロードする必要があります。 img変数は、LeptonicaのPIX形式で入力画像をロードします。これはアンマネージC++オブジェクトであり、メモリリークを防ぐために明示的な破棄が必要です。 pageの結果は、実際の文字認識操作を実行します。
Tesseractはなぜ最初に画像変換を必要とするのですか?

Tesseractのアーキテクチャは、文書処理ではなく、画像処理に特化している。 この設計では、開発者はPDFから画像への変換パイプラインを自ら管理する必要があり、パスワードで保護されたPDF 、複数ページの文書、またはテキストレイヤーとラスタライズされたスキャンを組み合わせた混合コンテンツのPDFを扱う際に、複雑さが増す。 変換品質はOCRの精度に直接影響するため、適切なDPI設定と前処理は、満足のいく結果を得るために不可欠です。
Tesseractで複数のPDFページを処理するにはどうすればよいですか?
本番環境では、複数ページのドキュメントを処理するには、各PDFページを画像に変換し、個別に処理し、すべてのページにわたって結果を集約するオーケストレーションロジックが必要です。
using Tesseract;
using System.Text;
// Processing multiple PDF pages after prior PDF-to-image conversion
static string ProcessMultiPagePdf(string[] imagePaths)
{
var results = new StringBuilder();
using var engine = new TesseractEngine(@"./tessdata", "eng", EngineMode.Default);
foreach (var imagePath in imagePaths)
{
using var img = Pix.LoadFromFile(imagePath);
using var page = engine.Process(img);
results.AppendLine($"Page confidence: {page.GetMeanConfidence():F2}");
results.AppendLine(page.GetText());
results.AppendLine("---");
}
return results.ToString();
}using Tesseract;
using System.Text;
// Processing multiple PDF pages after prior PDF-to-image conversion
static string ProcessMultiPagePdf(string[] imagePaths)
{
var results = new StringBuilder();
using var engine = new TesseractEngine(@"./tessdata", "eng", EngineMode.Default);
foreach (var imagePath in imagePaths)
{
using var img = Pix.LoadFromFile(imagePath);
using var page = engine.Process(img);
results.AppendLine($"Page confidence: {page.GetMeanConfidence():F2}");
results.AppendLine(page.GetText());
results.AppendLine("---");
}
return results.ToString();
}Imports Tesseract
Imports System.Text
' Processing multiple PDF pages after prior PDF-to-image conversion
Private Shared Function ProcessMultiPagePdf(imagePaths As String()) As String
Dim results As New StringBuilder()
Using engine As New TesseractEngine("./tessdata", "eng", EngineMode.Default)
For Each imagePath In imagePaths
Using img = Pix.LoadFromFile(imagePath)
Using page = engine.Process(img)
results.AppendLine($"Page confidence: {page.GetMeanConfidence():F2}")
results.AppendLine(page.GetText())
results.AppendLine("---")
End Using
End Using
Next
End Using
Return results.ToString()
End FunctionImports Tesseract
Imports System.Text
' Processing multiple PDF pages after prior PDF-to-image conversion
Private Shared Function ProcessMultiPagePdf(imagePaths As String()) As String
Dim results As New StringBuilder()
Using engine As New TesseractEngine("./tessdata", "eng", EngineMode.Default)
For Each imagePath In imagePaths
Using img = Pix.LoadFromFile(imagePath)
Using page = engine.Process(img)
results.AppendLine($"Page confidence: {page.GetMeanConfidence():F2}")
results.AppendLine(page.GetText())
results.AppendLine("---")
End Using
End Using
Next
End Using
Return results.ToString()
End Functionこのコードが処理するには、PDFの各ページを個別に画像に変換する必要があります。 その変換処理(適切なDPIでのページレンダリング、一時ファイルの書き込み、およびそれらのクリーンアップ)のオーケストレーションロジックは、この関数とは別の場所にあり、別のライブラリが必要です。 この複数ステップからなるパイプラインは、概念的には単純な操作であるにもかかわらず、追加の障害発生箇所を生み出し、コードベースのサイズを大幅に増加させる。
基本的なテセラクト処理では、どのような結果が期待できますか?

page.GetMeanConfidence()によって返される信頼スコアは、抽出品質の検証に役立ちますが、手動による解釈とカスタムのしきい値ロジックが必要です。 背景ノイズ、歪み、または低解像度のあるスキャン文書は、許容できる精度を達成するために、OCRの前に前処理が必要です。 TesseractはPDFを直接処理するのではなく画像を処理するため、中間段階である画像変換の品質が最終的なOCR精度に大きく影響します。つまり、変換パイプラインのバグはOCR精度の問題として現れ、原因の特定が困難になる場合があります。
IronOCRはC#でPDFを直接どう処理しますか?
IronOCRはPDFをネイティブでサポートしているため、スキャンした文書を中間画像形式に変換する必要がありません。 このライブラリはPDFレンダリングを内部的に処理するため、 .NET 10アプリケーションのワークフローが簡素化されます。 この統合的なアプローチは、パフォーマンスと信頼性が重要な要件となるEnterprise文書処理において特に有効であることが証明されています。
using IronOcr;
// Initialize the OCR engine (built on optimized Tesseract 5)
var ocr = new IronTesseract();
ocr.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.Auto;
ocr.Configuration.ReadBarCodes = true; // Detect barcodes and QR codes alongside text
// Load PDF directly - no image conversion required
using var input = new OcrInput();
input.LoadPdf("scanned-document.pdf", Password: "optional-password");
// Apply preprocessing for low-quality scans
input.DeNoise(); // Remove background noise from scanned paper
input.Deskew(); // Correct rotation from camera angle
input.EnhanceResolution(300); // Ensure adequate DPI for accurate recognition
// Extract text from all pages
OcrResult result = ocr.Read(input);
Console.WriteLine($"Confidence: {result.Confidence}%");
Console.WriteLine($"Pages: {result.Pages.Count()}");
Console.WriteLine(result.Text);
// Export results as a searchable PDF
result.SaveAsSearchablePdf("searchable-output.pdf");using IronOcr;
// Initialize the OCR engine (built on optimized Tesseract 5)
var ocr = new IronTesseract();
ocr.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.Auto;
ocr.Configuration.ReadBarCodes = true; // Detect barcodes and QR codes alongside text
// Load PDF directly - no image conversion required
using var input = new OcrInput();
input.LoadPdf("scanned-document.pdf", Password: "optional-password");
// Apply preprocessing for low-quality scans
input.DeNoise(); // Remove background noise from scanned paper
input.Deskew(); // Correct rotation from camera angle
input.EnhanceResolution(300); // Ensure adequate DPI for accurate recognition
// Extract text from all pages
OcrResult result = ocr.Read(input);
Console.WriteLine($"Confidence: {result.Confidence}%");
Console.WriteLine($"Pages: {result.Pages.Count()}");
Console.WriteLine(result.Text);
// Export results as a searchable PDF
result.SaveAsSearchablePdf("searchable-output.pdf");Imports IronOcr
' Initialize the OCR engine (built on optimized Tesseract 5)
Dim ocr As New IronTesseract()
ocr.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.Auto
ocr.Configuration.ReadBarCodes = True ' Detect barcodes and QR codes alongside text
' Load PDF directly - no image conversion required
Using input As New OcrInput()
input.LoadPdf("scanned-document.pdf", Password:="optional-password")
' Apply preprocessing for low-quality scans
input.DeNoise() ' Remove background noise from scanned paper
input.Deskew() ' Correct rotation from camera angle
input.EnhanceResolution(300) ' Ensure adequate DPI for accurate recognition
' Extract text from all pages
Dim result As OcrResult = ocr.Read(input)
Console.WriteLine($"Confidence: {result.Confidence}%")
Console.WriteLine($"Pages: {result.Pages.Count()}")
Console.WriteLine(result.Text)
' Export results as a searchable PDF
result.SaveAsSearchablePdf("searchable-output.pdf")
End UsingImports IronOcr
' Initialize the OCR engine (built on optimized Tesseract 5)
Dim ocr As New IronTesseract()
ocr.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.Auto
ocr.Configuration.ReadBarCodes = True ' Detect barcodes and QR codes alongside text
' Load PDF directly - no image conversion required
Using input As New OcrInput()
input.LoadPdf("scanned-document.pdf", Password:="optional-password")
' Apply preprocessing for low-quality scans
input.DeNoise() ' Remove background noise from scanned paper
input.Deskew() ' Correct rotation from camera angle
input.EnhanceResolution(300) ' Ensure adequate DPI for accurate recognition
' Extract text from all pages
Dim result As OcrResult = ocr.Read(input)
Console.WriteLine($"Confidence: {result.Confidence}%")
Console.WriteLine($"Pages: {result.Pages.Count()}")
Console.WriteLine(result.Text)
' Export results as a searchable PDF
result.SaveAsSearchablePdf("searchable-output.pdf")
End UsingIronTesseractクラスは、.NET Coreおよび.NET Framework環境用に特別に構築された最適化されたTesseract 5エンジンをラップします。 標準 for .NETラッパーとは異なり、この実装ではメモリを自動的に管理し、 .NETアプリケーション向けに最適化されたパフォーマンス機能が含まれています。 LoadPdfを介してPDFファイルを直接受け入れます。追加のライブラリをダウンロードまたは設定することなく内部でページをレンダリングします。
Deskew()メソッドは組み込みの前処理フィルターを適用します。これにより、ノイズ、斑点、回転アーティファクトのある実際のスキャン文書の精度が大幅に向上します。 OcrResultオブジェクトは、抽出されたテキストとともに信頼スコアと文字位置を含んでおり、後処理検証用に使用できます。 また、単一のメソッド呼び出しで結果を検索可能なPDFとしてエクスポートすることもできます。これは、Tesseractでは追加ライブラリなしでは実現できません。
より詳細な制御を行うには、特定のページまたはドキュメント領域を対象とすることができます。
using IronOcr;
using System.Drawing;
var ocr = new IronTesseract();
// Restrict character recognition to digits and currency symbols for financial docs
ocr.Configuration = new TesseractConfiguration
{
WhiteListCharacters = "0123456789.$,",
PageSegmentationMode = TesseractPageSegmentationMode.SingleColumn
};
// Load only the first two pages from a financial report
using var input = new OcrInput();
input.LoadPdfPages("financial-report.pdf", new[] { 0, 1 });
// Target a specific crop region, such as an invoice total field
var cropRegion = new CropRectangle(x: 100, y: 500, width: 400, height: 200);
foreach (var page in input.Pages)
page.AddCropRegion(cropRegion);
OcrResult result = ocr.Read(input);
foreach (var page in result.Pages)
{
Console.WriteLine($"Page {page.PageNumber}:");
foreach (var paragraph in page.Paragraphs)
Console.WriteLine($" ({paragraph.Confidence}%) {paragraph.Text}");
}using IronOcr;
using System.Drawing;
var ocr = new IronTesseract();
// Restrict character recognition to digits and currency symbols for financial docs
ocr.Configuration = new TesseractConfiguration
{
WhiteListCharacters = "0123456789.$,",
PageSegmentationMode = TesseractPageSegmentationMode.SingleColumn
};
// Load only the first two pages from a financial report
using var input = new OcrInput();
input.LoadPdfPages("financial-report.pdf", new[] { 0, 1 });
// Target a specific crop region, such as an invoice total field
var cropRegion = new CropRectangle(x: 100, y: 500, width: 400, height: 200);
foreach (var page in input.Pages)
page.AddCropRegion(cropRegion);
OcrResult result = ocr.Read(input);
foreach (var page in result.Pages)
{
Console.WriteLine($"Page {page.PageNumber}:");
foreach (var paragraph in page.Paragraphs)
Console.WriteLine($" ({paragraph.Confidence}%) {paragraph.Text}");
}Imports IronOcr
Imports System.Drawing
Dim ocr As New IronTesseract()
' Restrict character recognition to digits and currency symbols for financial docs
ocr.Configuration = New TesseractConfiguration With {
.WhiteListCharacters = "0123456789.$,",
.PageSegmentationMode = TesseractPageSegmentationMode.SingleColumn
}
' Load only the first two pages from a financial report
Using input As New OcrInput()
input.LoadPdfPages("financial-report.pdf", {0, 1})
' Target a specific crop region, such as an invoice total field
Dim cropRegion As New CropRectangle(x:=100, y:=500, width:=400, height:=200)
For Each page In input.Pages
page.AddCropRegion(cropRegion)
Next
Dim result As OcrResult = ocr.Read(input)
For Each page In result.Pages
Console.WriteLine($"Page {page.PageNumber}:")
For Each paragraph In page.Paragraphs
Console.WriteLine($" ({paragraph.Confidence}%) {paragraph.Text}")
Next
Next
End UsingImports IronOcr
Imports System.Drawing
Dim ocr As New IronTesseract()
' Restrict character recognition to digits and currency symbols for financial docs
ocr.Configuration = New TesseractConfiguration With {
.WhiteListCharacters = "0123456789.$,",
.PageSegmentationMode = TesseractPageSegmentationMode.SingleColumn
}
' Load only the first two pages from a financial report
Using input As New OcrInput()
input.LoadPdfPages("financial-report.pdf", {0, 1})
' Target a specific crop region, such as an invoice total field
Dim cropRegion As New CropRectangle(x:=100, y:=500, width:=400, height:=200)
For Each page In input.Pages
page.AddCropRegion(cropRegion)
Next
Dim result As OcrResult = ocr.Read(input)
For Each page In result.Pages
Console.WriteLine($"Page {page.PageNumber}:")
For Each paragraph In page.Paragraphs
Console.WriteLine($" ({paragraph.Confidence}%) {paragraph.Text}")
Next
Next
End UsingLoadPdfPagesメソッドは、ゼロベースのページインデックスを受け入れるため、大きな文書をすべてのページをメモリにロードせずに選択的に処理できます。 地域ベースの抽出は、請求書や財務諸表などの構造化文書において、特定のフィールドのみを抽出する必要がある場合に不可欠です。 文字ホワイトリストの設定により、文書に既知の文字セットが含まれている場合に誤検出を防ぐことができます。
IronOCRはどのような種類のPDFファイルを処理できますか?
IronOCRは、スキャンされた文書、ネイティブテキストのPDF、混合コンテンツ、およびパスワードで保護されたファイルを処理します。 このライブラリは、PDFに抽出可能なテキストが含まれているか、OCR処理が必要かを自動的に検出し、追加の設定なしにそれぞれのケースに合わせてパフォーマンスを最適化します。 ストリームベースの入力は、一時ファイルを書き込むことなくメモリからドキュメントを処理することを可能にするため、クラウド環境やファイルシステムに厳しい制限がある環境に特に適しています。
IronOCRは特殊な文書タイプをどのように処理しますか?
IronOCRは、各フォーマットに最適化された機械学習モデルを使用し、特殊な文書タイプ向けに専用の手法を提供します。
using IronOcr;
var ocr = new IronTesseract();
// Extract text from a vehicle license plate
var licensePlateResult = ocr.ReadLicensePlate("car-photo.jpg");
Console.WriteLine($"License Plate: {licensePlateResult.Text}");
// Read passport MRZ fields from a scanned document
var passportResult = ocr.ReadPassport("passport-scan.pdf");
Console.WriteLine($"Number: {passportResult.PassportNumber}");
Console.WriteLine($"Name: {passportResult.GivenNames} {passportResult.Surname}");
// Process MICR cheques for banking workflows
var chequeResult = ocr.ReadMicrCheque("cheque-image.tiff");
Console.WriteLine($"Account: {chequeResult.AccountNumber}");
Console.WriteLine($"Routing: {chequeResult.RoutingNumber}");using IronOcr;
var ocr = new IronTesseract();
// Extract text from a vehicle license plate
var licensePlateResult = ocr.ReadLicensePlate("car-photo.jpg");
Console.WriteLine($"License Plate: {licensePlateResult.Text}");
// Read passport MRZ fields from a scanned document
var passportResult = ocr.ReadPassport("passport-scan.pdf");
Console.WriteLine($"Number: {passportResult.PassportNumber}");
Console.WriteLine($"Name: {passportResult.GivenNames} {passportResult.Surname}");
// Process MICR cheques for banking workflows
var chequeResult = ocr.ReadMicrCheque("cheque-image.tiff");
Console.WriteLine($"Account: {chequeResult.AccountNumber}");
Console.WriteLine($"Routing: {chequeResult.RoutingNumber}");Imports IronOcr
Dim ocr As New IronTesseract()
' Extract text from a vehicle license plate
Dim licensePlateResult = ocr.ReadLicensePlate("car-photo.jpg")
Console.WriteLine($"License Plate: {licensePlateResult.Text}")
' Read passport MRZ fields from a scanned document
Dim passportResult = ocr.ReadPassport("passport-scan.pdf")
Console.WriteLine($"Number: {passportResult.PassportNumber}")
Console.WriteLine($"Name: {passportResult.GivenNames} {passportResult.Surname}")
' Process MICR cheques for banking workflows
Dim chequeResult = ocr.ReadMicrCheque("cheque-image.tiff")
Console.WriteLine($"Account: {chequeResult.AccountNumber}")
Console.WriteLine($"Routing: {chequeResult.RoutingNumber}")Imports IronOcr
Dim ocr As New IronTesseract()
' Extract text from a vehicle license plate
Dim licensePlateResult = ocr.ReadLicensePlate("car-photo.jpg")
Console.WriteLine($"License Plate: {licensePlateResult.Text}")
' Read passport MRZ fields from a scanned document
Dim passportResult = ocr.ReadPassport("passport-scan.pdf")
Console.WriteLine($"Number: {passportResult.PassportNumber}")
Console.WriteLine($"Name: {passportResult.GivenNames} {passportResult.Surname}")
' Process MICR cheques for banking workflows
Dim chequeResult = ocr.ReadMicrCheque("cheque-image.tiff")
Console.WriteLine($"Account: {chequeResult.AccountNumber}")
Console.WriteLine($"Routing: {chequeResult.RoutingNumber}")これらの特殊な手法は、文書の種類ごとに最適化された構成とモデルを使用するため、汎用エンジンを手動で構成するよりも高い精度を実現します。 ナンバープレート認識システムは、様々な国際規格に対応しています。 パスポート読み取り機能により、MRZデータが自動的に抽出されます。 MICR小切手処理は、手動によるエンジン設定なしで銀行文書を処理します。 これらの文書タイプでTesseractと同等の精度を達成するには、専用のトレーニングデータとモデルの調整が必要となる。
セットアップとワークフローの主な違いは何ですか?
Tesseractのインストールがより複雑なのはなぜですか?
Tesseractを.NET 10環境で動作させるには、OCRエンジンバイナリ、Leptonica画像処理ライブラリ、Windows用のVisual C++再頒布可能パッケージ、および認識対象言語ごとの言語データファイルなど、いくつかのコンポーネントが必要です。開発者は、ライブラリが正常に初期化される前に、tessdataファイルを個別にダウンロードし、正しいフォルダパスを設定する必要があります。 Azure、Dockerコンテナ、またはLinuxサーバーへのクロスプラットフォーム展開では、プラットフォーム固有の設定や依存関係のトラブルシューティングが必要となることが多く、これらを確実に自動化することは困難です。
Azure FunctionsやAWS Lambdaのデプロイメントでは、ランタイム環境が外部バイナリやメモリ割り当てに厳しい制限を課すため、依存関係の複雑さがさらに増します。 AVX命令サポートがない古いCPUでは、実行時にSEHExceptionエラーが発生し、アプリケーションロジックとは無関係のインシデントの診断層を追加します。 libgdiplus依存は、非Windowsプラットフォームで追加の課題を引き起こします。
IronOCRはどのようにしてインストールを簡素化するのですか?
IronOCRは、インストールを単一のNuGetパッケージに簡素化し、管理すべき外部バイナリを一切排除します。
特殊なスキャン機能や追加言語サポートについては、以下をご覧ください。
# Advanced scanning algorithms (optional)
Install-Package IronOcr.Extensions.AdvancedScan
# Language packs install as needed
Install-Package IronOcr.Languages.French
Install-Package IronOcr.Languages.Japanese

必要な部品はすべてパッケージ内に同梱されています。 言語パックのインストールは、メインライブラリと同様に簡単で、tessdataフォルダの手動管理は不要です。 IronOCRは、デフォルトでWindows、macOS、Linuxにおいて.NET Framework 4.6.2以降、 .NET Core、および.NET 5~10をサポートしています。
本番環境向けサービスの場合、進捗状況の追跡とキャンセル機能を備えた完全な非同期処理の例を以下に示します。
using IronOcr;
async Task<OcrResult> ProcessPdfAsync(string pdfPath)
{
var ocr = new IronTesseract();
// Report progress to the caller for user feedback in batch workflows
ocr.OcrProgress += (sender, e) =>
Console.WriteLine($"Page {e.PagesComplete}/{e.TotalPages}: {e.ProgressPercent}%");
using var input = new OcrInput();
// Use a lower DPI for very large files to reduce memory pressure
if (new System.IO.FileInfo(pdfPath).Length > 100_000_000)
input.TargetDPI = 150;
input.LoadPdf(pdfPath);
input.DeNoise();
input.Deskew();
// Cancel automatically after 5 minutes to prevent resource exhaustion
using var cts = new System.Threading.CancellationTokenSource(TimeSpan.FromMinutes(5));
return await ocr.ReadAsync(input, cts.Token);
}using IronOcr;
async Task<OcrResult> ProcessPdfAsync(string pdfPath)
{
var ocr = new IronTesseract();
// Report progress to the caller for user feedback in batch workflows
ocr.OcrProgress += (sender, e) =>
Console.WriteLine($"Page {e.PagesComplete}/{e.TotalPages}: {e.ProgressPercent}%");
using var input = new OcrInput();
// Use a lower DPI for very large files to reduce memory pressure
if (new System.IO.FileInfo(pdfPath).Length > 100_000_000)
input.TargetDPI = 150;
input.LoadPdf(pdfPath);
input.DeNoise();
input.Deskew();
// Cancel automatically after 5 minutes to prevent resource exhaustion
using var cts = new System.Threading.CancellationTokenSource(TimeSpan.FromMinutes(5));
return await ocr.ReadAsync(input, cts.Token);
}Imports IronOcr
Imports System.IO
Imports System.Threading
Public Async Function ProcessPdfAsync(pdfPath As String) As Task(Of OcrResult)
Dim ocr As New IronTesseract()
' Report progress to the caller for user feedback in batch workflows
AddHandler ocr.OcrProgress, Sub(sender, e)
Console.WriteLine($"Page {e.PagesComplete}/{e.TotalPages}: {e.ProgressPercent}%")
End Sub
Using input As New OcrInput()
' Use a lower DPI for very large files to reduce memory pressure
If New FileInfo(pdfPath).Length > 100_000_000 Then
input.TargetDPI = 150
End If
input.LoadPdf(pdfPath)
input.DeNoise()
input.Deskew()
' Cancel automatically after 5 minutes to prevent resource exhaustion
Using cts As New CancellationTokenSource(TimeSpan.FromMinutes(5))
Return Await ocr.ReadAsync(input, cts.Token)
End Using
End Using
End FunctionImports IronOcr
Imports System.IO
Imports System.Threading
Public Async Function ProcessPdfAsync(pdfPath As String) As Task(Of OcrResult)
Dim ocr As New IronTesseract()
' Report progress to the caller for user feedback in batch workflows
AddHandler ocr.OcrProgress, Sub(sender, e)
Console.WriteLine($"Page {e.PagesComplete}/{e.TotalPages}: {e.ProgressPercent}%")
End Sub
Using input As New OcrInput()
' Use a lower DPI for very large files to reduce memory pressure
If New FileInfo(pdfPath).Length > 100_000_000 Then
input.TargetDPI = 150
End If
input.LoadPdf(pdfPath)
input.DeNoise()
input.Deskew()
' Cancel automatically after 5 minutes to prevent resource exhaustion
Using cts As New CancellationTokenSource(TimeSpan.FromMinutes(5))
Return Await ocr.ReadAsync(input, cts.Token)
End Using
End Using
End Functionこのパターンは、IronOCRの非同期処理サポートと、組み込みの進捗状況レポートおよびキャンセル機能を示しています。 CancellationTokenSourceは、予期しない大きな文書を処理するときのリソース枯渇を防ぎ、進行イベントはエンドユーザーにステータスを報告する必要があるバッチワークフローにリアルタイムフィードバックを提供します。
TesseractとIronOCRのライセンスの違いは何ですか?
ライセンスモデルは、両ライブラリ間の最も根本的な違いであり、総所有コストと長期的なメンテナンス負担に直接影響を与える。
Tesseractのオープンソースライセンスは、実際にはどのような意味を持つのでしょうか?
TesseractはApache 2.0ライセンスの下でリリースされており、オープンソースアプリケーションと商用アプリケーションの両方で、ロイヤリティなしで自由に利用できます。 しかし、Tesseractのコストはゼロではありません。初期設定、PDFから画像への変換パイプラインの開発、デプロイメントターゲット全体にわたる依存関係の管理、および環境の変化に伴う継続的なメンテナンスに必要な開発者の時間を考慮すると、コストはゼロではないことがわかります。 セットアップの手間が許容範囲内である画像のみのOCRワークフローにおいては、Tesseractは真に費用対効果の高い出発点となる。
IronOCRの商用ライセンスには何が含まれていますか?
IronOCRを本番環境に導入するには、商用ライセンスが必要です。 ライセンス体系は、個人開発者、小規模チーム、Enterpriseでの再配布といったシナリオに対応しており、ロイヤリティフリーのオプションも用意されています。 クレジットカード不要で無料トライアルをご利用いただけます。 商用ライセンスには、テクニカルサポート、定期的なアップデート、セキュリティパッチへのアクセスが含まれており、アプリケーションのライフサイクル全体にわたる継続的なメンテナンスコストを削減します。本番環境のSLAに基づいて大量のPDFドキュメントを処理するチームにとって、ライセンス費用は、インフラストラクチャのセットアップや本番環境におけるインシデント調査に費やす開発者の時間の削減によって相殺されることがよくあります。
.NETアプリケーションにはどのOCRライブラリを選択すべきか?
TesseractとIronOCRのどちらを選択するかは、プロジェクトの入力フォーマット、導入対象、およびチームのリソースによって異なります。
Tesseractを選ぶべき場面:
予算の制約上、完全無料のオープンソースソリューションが求められる。 入力内容は画像ファイルのみで、PDF文書は含まれません。 ・貴チームはC++の相互運用に関する経験と依存関係管理能力を有しています。
- カスタムOCRエンジンのトレーニングまたは専門的な辞書サポートが必要です プロジェクトのタイムラインにより、追加のセットアップとトラブルシューティング作業が可能になります。
IronOCRを選ぶべき場面:
- PDFファイルとスキャンした文書が主な入力フォーマットです。 開発スピードと最小限の定型コードが優先事項です クラウド環境、Docker、またはLinuxへのクロスプラットフォーム展開が必要です ・組み込みの前処理フィルターにより、実世界のスキャンにおける精度が向上する。
- 商用サポートと定期的なアップデートにより、製品の価値が高まります。 パスワードで保護されたPDFファイルまたは多言語文書が必要です スキャンした文書から検索可能なPDF出力を生成する必要があります
どちらのライブラリも、認識の中核としてTesseractのOCRエンジンを使用しています。 IronOCRは、ネイティブな.NET統合、自動メモリ管理、組み込みの前処理、および直接的なPDFサポートによって機能を拡張し、本番環境 for .NETアプリケーションでOCRパイプラインを構築する際に発生する一般的な問題点を解決します。 アーキテクチャ上の違いは、規模が大きくなるにつれて最も顕著になる。Tesseractベースのパイプラインでは複数のライブラリの依存関係を管理する必要があるのに対し、 IronOCRパイプラインでは単一のNuGetパッケージに解決される。
次のステップは何ですか?
IronOCRの無料トライアルを開始して、ご自身の文書を使ってPDFテキスト抽出機能を評価してみてください。 特定のシナリオに関するより詳細な情報については、 PDF入力ガイド、画像前処理フィルター、および検索可能なPDFエクスポートドキュメントを参照してください。 本番環境への導入計画のために、 IronOCRのライセンスオプションを確認してください。
関連する記事


