なぜIronOCRがTesseract 4 NuGetパッケージよりも優れているのか

C#でTesseract OCRを実行する方法 IronOCRの代替手段

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

C# アプリケーションに光学文字認識を実装したいとお考えですか? Google Tesseract は無料の OCR ソリューションを提供していますが、多くの開発者は、その複雑な設定、実際のドキュメントに対する精度の限界、そして難しい C++ 相互運用性要件に苦労しています。 この包括的なガイドでは、インストールの手間を省きながら優れた結果をもたらすネイティブ C# ライブラリである IronOCR の強化された Tesseract 実装を使用して、99.8 ~ 100% の OCR 精度を達成する方法を説明します。

スキャンした文書からテキストを抽出したり、請求書を処理したり、文書自動化システムを構築したりする場合でも、数週間ではなく数分で本番環境対応の OCR を実装する方法を学習します。

クイックスタート: IronTesseract を使用した 1 行 OCR

IronOCR の最もシンプルな API を使用して、数秒でテキストを取得します。 この例では、1 行のコードで IronTesseract を呼び出し、画像を入力し、認識されたテキストを取得する方法を示しています。手間をかけずに結果だけが得られます。

Nuget Icon今すぐ NuGet で PDF を作成してみましょう:

  1. NuGet パッケージ マネージャーを使用して IronOCR をインストールします

    PM > Install-Package IronOcr

  2. このコード スニペットをコピーして実行します。

    string text = new IronTesseract().Read(new OcrInput("image.png")).Text;
  3. 実際の環境でテストするためにデプロイする

    今すぐ無料トライアルでプロジェクトに IronOCR を使い始めましょう
    arrow pointer

IronOCR の C# 向け Tesseract 実装の包括的な機能概要。プラットフォームの互換性、サポートされている形式、高度な処理機能を示します。

最小限のコードで C# で画像からテキストを抽出するにはどうすればよいでしょうか?

次の例は、わずか数行のコードを使用して .NET アプリケーションに OCR 機能を実装する方法を示しています。 通常の Tesseract とは異なり、このアプローチでは画像の前処理が自動的に行われ、不完全なスキャンでも正確な結果が得られます。

NuGet パッケージ マネージャーを使用して、IronOCR NuGet パッケージを Visual Studio ソリューションにインストールします。

using IronOcr;
using System;

// Initialize IronTesseract for performing OCR (Optical Character Recognition)
var ocr = new IronTesseract
{
    // Set the language for the OCR process to English
    Language = OcrLanguage.English
};

// Create a new OCR input that can hold the images to be processed
using var input = new OcrInput();

// Specify the page indices to be processed from the TIFF image
var pageIndices = new int[] { 1, 2 };

// Load specific pages of the TIFF image into the OCR input object
// Perfect for processing large multi-page documents efficiently
input.LoadImageFrames(@"img\example.tiff", pageIndices);

// Optional pre-processing steps (uncomment as needed)
// input.DeNoise();  // Remove digital noise from scanned documents
// input.Deskew();   // Automatically straighten tilted scans

// Perform OCR on the provided input
OcrResult result = ocr.Read(input);

// Output the recognized text to the console
Console.WriteLine(result.Text);

// Note: The OcrResult object contains detailed information including:
// - Individual words with confidence scores
// - Character positions and bounding boxes
// - Paragraph and line structure
using IronOcr;
using System;

// Initialize IronTesseract for performing OCR (Optical Character Recognition)
var ocr = new IronTesseract
{
    // Set the language for the OCR process to English
    Language = OcrLanguage.English
};

// Create a new OCR input that can hold the images to be processed
using var input = new OcrInput();

// Specify the page indices to be processed from the TIFF image
var pageIndices = new int[] { 1, 2 };

// Load specific pages of the TIFF image into the OCR input object
// Perfect for processing large multi-page documents efficiently
input.LoadImageFrames(@"img\example.tiff", pageIndices);

// Optional pre-processing steps (uncomment as needed)
// input.DeNoise();  // Remove digital noise from scanned documents
// input.Deskew();   // Automatically straighten tilted scans

// Perform OCR on the provided input
OcrResult result = ocr.Read(input);

// Output the recognized text to the console
Console.WriteLine(result.Text);

// Note: The OcrResult object contains detailed information including:
// - Individual words with confidence scores
// - Character positions and bounding boxes
// - Paragraph and line structure
Imports IronOcr
Imports System

' Initialize IronTesseract for performing OCR (Optical Character Recognition)
Private ocr = New IronTesseract With {.Language = OcrLanguage.English}

' Create a new OCR input that can hold the images to be processed
Private input = New OcrInput()

' Specify the page indices to be processed from the TIFF image
Private pageIndices = New Integer() { 1, 2 }

' Load specific pages of the TIFF image into the OCR input object
' Perfect for processing large multi-page documents efficiently
input.LoadImageFrames("img\example.tiff", pageIndices)

' Optional pre-processing steps (uncomment as needed)
' input.DeNoise();  // Remove digital noise from scanned documents
' input.Deskew();   // Automatically straighten tilted scans

' Perform OCR on the provided input
Dim result As OcrResult = ocr.Read(input)

' Output the recognized text to the console
Console.WriteLine(result.Text)

' Note: The OcrResult object contains detailed information including:
' - Individual words with confidence scores
' - Character positions and bounding boxes
' - Paragraph and line structure
$vbLabelText   $csharpLabel

このコードは、IronOCR の簡素化された API の威力を示すものです。 IronTesseractクラスはTesseract 5のマネージドラッパーを提供し、複雑なC++相互運用性を必要としませんOcrInputクラスは複数の画像形式とページの読み込みをサポートし、オプションの前処理メソッド( DeNoise()Deskew() )は実際のドキュメントの精度を大幅に向上させます。

OcrResultオブジェクトは、基本的なテキスト抽出を超えて、単語レベルの信頼度スコア、文字の位置、ドキュメント構造などの豊富な構造化データを提供し、検索可能な PDF の作成正確なテキスト位置の追跡などの高度な機能を実現します。

Tesseract と IronOCR のインストールにおける主な違いは何ですか?

.NET で Tesseract エンジンを使用して OCR を実行する

C# での従来の Tesseract 統合では C++ ライブラリの管理が必要となり、いくつかの課題が生じます。

開発者は、プラットフォーム固有のバイナリを処理し、Visual C++ ランタイムのインストールを確認し、32/64 ビットの互換性の問題を管理する必要があります。 セットアップでは、多くの場合、Tesseract および Leptonica ライブラリを手動でコンパイルする必要があります。特に、Windows コンパイル用に設計されていない最新の Tesseract 5 バージョンではこれが必要になります。

クロスプラットフォーム展開は、権限と依存関係が大きく異なる Azure、Docker、または Linux 環境では特に問題になります。

C# 用の IronOCR Tesseract

IronOCR は、NuGet 経由で配布される単一の管理対象 .NET ライブラリを通じてインストールの複雑さを排除します。

Install-Package IronOcr

ネイティブ DLL、C++ ランタイム、プラットフォーム固有の構成はありません。 すべてが、依存関係の自動解決を伴う純粋なマネージ コードとして実行されます。

このライブラリは、以下のものと完全な互換性を提供します。

  • .NET Framework 4.6.2 以上
  • .NET Standard 2.0 以上 (.NET 5、6、7、8、9、10 を含む)
  • .NET Core 2.0以上

このアプローチにより、Windows、macOS、Linux、Azure、AWS Lambda、Docker コンテナー、さらには Xamarin モバイル アプリケーション全体で一貫した動作が保証されます。

.NET 開発における最新の OCR エンジン バージョンの比較

C# を使った Google Tesseract

Tesseract 5 は強力ですが、Windows 開発者にとって大きな課題があります。

最新のビルドでは MinGW を使用したクロスコンパイルが必要ですが、動作する Windows バイナリが生成されることはほとんどありません。 GitHub 上の無料の C# ラッパーは、最新の Tesseract リリースより何年も遅れていることが多く、重要な改善やバグ修正が欠けています。 開発者は、これらのコンパイル障壁のために、古い Tesseract 3.x または 4.x バージョンを使用することが多いです。

.NET 用 IronOCR Tesseract

IronOCR には、.NET 専用に最適化されたカスタムビルドの Tesseract 5 エンジンが搭載されています。

この実装には、ネイティブ マルチスレッド サポート、自動画像前処理、大規模ドキュメントのメモリ効率の高い処理などのパフォーマンス強化が含まれています。 定期的な更新により、下位互換性を維持しながら最新の .NET リリースとの互換性が確保されます。

このライブラリは専用の NuGet パッケージを通じて広範な言語サポートも提供しており、外部辞書ファイルを管理することなく 127 を超える言語の OCR 機能を簡単に追加できます。

Google Cloud OCRの比較

Google Cloud Vision OCRは高い精度を提供しますが、インターネット接続が必要であり、リクエストごとにコストが発生し、機密文書のデータ プライバシーに関する懸念が生じます。 IronOCR はオンプレミス処理と同等の精度を提供するため、データセキュリティやオフライン機能を必要とするアプリケーションに最適です。

さまざまなアプローチでどの程度の OCR 精度を達成できますか?

.NET プロジェクトにおける Google Tesseract

Raw Tesseract は、高解像度で完璧に整列したテキストの読み取りに優れていますが、現実世界のドキュメントの読み取りには苦労します。

スキャンしたページ、写真、または低解像度の画像は、事前に徹底的に処理しないと、文字化けした出力になることがよくあります。 許容できる精度を達成するには、通常、ImageMagick または同様のツールを使用したカスタム画像処理パイプラインが必要となり、ドキュメントの種類ごとに開発時間が数週間追加されます。

一般的な精度の問題は次のとおりです。

  • 傾いた文書の文字が読み間違えられる
  • 低DPIスキャンでは完全に失敗する
  • フォントやレイアウトが混在するとパフォーマンスが低下する
  • 背景ノイズや透かしを処理できない

.NET プロジェクトにおける IronOCR Tesseract

IronOCR の強化された実装により、手動による前処理なしで、一般的なビジネス ドキュメントで99.8 ~ 100% の精度を実現します。

using IronOcr;
using System;

// Create an instance of the IronTesseract class for OCR processing
var ocr = new IronTesseract();

// Create an OcrInput object to load and preprocess images
using var input = new OcrInput();

// Specify which pages to extract from multi-page documents
var pageIndices = new int[] { 1, 2 };

// Load specific frames from a TIFF file
// IronOCR automatically detects and handles various image formats
input.LoadImageFrames(@"img\example.tiff", pageIndices);

// Apply automatic image enhancement filters
// These filters dramatically improve accuracy on imperfect scans
input.DeNoise();    // Removes digital artifacts and speckles
input.Deskew();     // Corrects rotation up to 15 degrees

// Perform OCR with enhanced accuracy algorithms
OcrResult result = ocr.Read(input);

// Access the extracted text with confidence metrics
Console.WriteLine(result.Text);

// Additional accuracy features available:
// - result.Confidence: Overall accuracy percentage
// - result.Pages[0].Words: Word-level confidence scores
// - result.Blocks: Structured document layout analysis
using IronOcr;
using System;

// Create an instance of the IronTesseract class for OCR processing
var ocr = new IronTesseract();

// Create an OcrInput object to load and preprocess images
using var input = new OcrInput();

// Specify which pages to extract from multi-page documents
var pageIndices = new int[] { 1, 2 };

// Load specific frames from a TIFF file
// IronOCR automatically detects and handles various image formats
input.LoadImageFrames(@"img\example.tiff", pageIndices);

// Apply automatic image enhancement filters
// These filters dramatically improve accuracy on imperfect scans
input.DeNoise();    // Removes digital artifacts and speckles
input.Deskew();     // Corrects rotation up to 15 degrees

// Perform OCR with enhanced accuracy algorithms
OcrResult result = ocr.Read(input);

// Access the extracted text with confidence metrics
Console.WriteLine(result.Text);

// Additional accuracy features available:
// - result.Confidence: Overall accuracy percentage
// - result.Pages[0].Words: Word-level confidence scores
// - result.Blocks: Structured document layout analysis
Imports IronOcr
Imports System

' Create an instance of the IronTesseract class for OCR processing
Private ocr = New IronTesseract()

' Create an OcrInput object to load and preprocess images
Private input = New OcrInput()

' Specify which pages to extract from multi-page documents
Private pageIndices = New Integer() { 1, 2 }

' Load specific frames from a TIFF file
' IronOCR automatically detects and handles various image formats
input.LoadImageFrames("img\example.tiff", pageIndices)

' Apply automatic image enhancement filters
' These filters dramatically improve accuracy on imperfect scans
input.DeNoise() ' Removes digital artifacts and speckles
input.Deskew() ' Corrects rotation up to 15 degrees

' Perform OCR with enhanced accuracy algorithms
Dim result As OcrResult = ocr.Read(input)

' Access the extracted text with confidence metrics
Console.WriteLine(result.Text)

' Additional accuracy features available:
' - result.Confidence: Overall accuracy percentage
' - result.Pages[0].Words: Word-level confidence scores
' - result.Blocks: Structured document layout analysis
$vbLabelText   $csharpLabel

自動前処理フィルターは、手動での介入が必要となる一般的なドキュメント品質の問題を処理します。 DeNoise()メソッドはスキャンからデジタル アーティファクトを除去し、 Deskew()はドキュメントの回転を修正します。どちらも高精度を維持するために重要です。

上級ユーザーは、文字のホワイトリスト、地域固有の処理、業界固有の用語用の特殊な言語モデルなどのカスタム構成を使用して、精度をさらに最適化できます。

OCR 処理でサポートされている画像形式とソースは何ですか?

.NET での Google Tesseract

ネイティブ Tesseract は、C# で操作するのが難しいアンマネージ C++ ポインターである Leptonica PIX 形式のみを受け入れます。

.NET イメージを PIX 形式に変換するには、メモリ リークを防ぐために慎重なメモリ管理が必要です。 PDF および複数ページの TIFF をサポートするには、独自の互換性の問題を伴う追加のライブラリが必要です。 多くの実装では基本的な形式の変換が困難で、実用的な使いやすさが制限されます。

IronOCR画像互換性

IronOCR は、自動変換による包括的な形式のサポートを提供します。

  • PDF文書(パスワード保護されたものを含む)
  • マルチフレームTIFFファイル
  • 標準フォーマット: JPEG、PNG、GIF、BMP
  • 高度なフォーマット: JPEG2000、WBMP
  • .NET 型: System.Drawing.ImageSystem.Drawing.Bitmap
  • データソース: ストリーム、バイト配列、ファイルパス -直接スキャナー統合

包括的なフォーマットサポートの例

using IronOcr;
using System;

// Initialize IronTesseract for OCR operations
var ocr = new IronTesseract();

// Create an OcrInput container for multiple sources
using var input = new OcrInput();

// Load password-protected PDFs seamlessly
// IronOCR handles PDF rendering internally
input.LoadPdf("example.pdf", "password");

// Process specific pages from multi-page TIFFs
// Perfect for batch document processing
var pageIndices = new int[] { 1, 2 };
input.LoadImageFrames("multi-frame.tiff", pageIndices);

// Add individual images in any common format
// Automatic format detection and conversion
input.LoadImage("image1.png");
input.LoadImage("image2.jpeg");

// Process all loaded content in a single operation
// Results maintain document structure and ordering
var result = ocr.Read(input);

// Extract text while preserving document layout
Console.WriteLine(result.Text);

// Advanced features for complex documents:
// - Extract images from specific PDF pages
// - Process only certain regions of images
// - Maintain reading order across mixed formats
using IronOcr;
using System;

// Initialize IronTesseract for OCR operations
var ocr = new IronTesseract();

// Create an OcrInput container for multiple sources
using var input = new OcrInput();

// Load password-protected PDFs seamlessly
// IronOCR handles PDF rendering internally
input.LoadPdf("example.pdf", "password");

// Process specific pages from multi-page TIFFs
// Perfect for batch document processing
var pageIndices = new int[] { 1, 2 };
input.LoadImageFrames("multi-frame.tiff", pageIndices);

// Add individual images in any common format
// Automatic format detection and conversion
input.LoadImage("image1.png");
input.LoadImage("image2.jpeg");

// Process all loaded content in a single operation
// Results maintain document structure and ordering
var result = ocr.Read(input);

// Extract text while preserving document layout
Console.WriteLine(result.Text);

// Advanced features for complex documents:
// - Extract images from specific PDF pages
// - Process only certain regions of images
// - Maintain reading order across mixed formats
Imports IronOcr
Imports System

' Initialize IronTesseract for OCR operations
Private ocr = New IronTesseract()

' Create an OcrInput container for multiple sources
Private input = New OcrInput()

' Load password-protected PDFs seamlessly
' IronOCR handles PDF rendering internally
input.LoadPdf("example.pdf", "password")

' Process specific pages from multi-page TIFFs
' Perfect for batch document processing
Dim pageIndices = New Integer() { 1, 2 }
input.LoadImageFrames("multi-frame.tiff", pageIndices)

' Add individual images in any common format
' Automatic format detection and conversion
input.LoadImage("image1.png")
input.LoadImage("image2.jpeg")

' Process all loaded content in a single operation
' Results maintain document structure and ordering
Dim result = ocr.Read(input)

' Extract text while preserving document layout
Console.WriteLine(result.Text)

' Advanced features for complex documents:
' - Extract images from specific PDF pages
' - Process only certain regions of images
' - Maintain reading order across mixed formats
$vbLabelText   $csharpLabel

ドキュメントを読み込むためのこの統一されたアプローチにより、形式固有のコードが不要になります。 スキャンした TIFF、デジタル PDF、スマートフォンの写真などを処理する場合でも、同じ API ですべてのシナリオを処理できます。 OcrInputクラスはメモリをインテリジェントに管理し、ソース形式に関係なく一貫した結果を提供します。

特殊なシナリオでは、IronOCR は同じドキュメントからのバーコードと QR コードの読み取りもサポートしており、1 回のパスで包括的なドキュメント データの抽出が可能になります。

実際のアプリケーションでの OCR パフォーマンスの比較

無料のGoogle Tesseractパフォーマンス

Vanilla Tesseract は、トレーニング データに一致する、前処理済みの高解像度画像で許容できる速度を実現できます。

しかし、現実世界でのパフォーマンスは期待外れになることが多いです。 Tesseract が画像品質に問題を抱えている場合、スキャンした文書の 1 ページの処理に 10 ~ 30 秒かかることがあります。 シングルスレッド アーキテクチャはバッチ処理のボトルネックとなり、大きな画像ではメモリ使用量が急増する可能性があります。

IronOCR Tesseractライブラリのパフォーマンス

IronOCR は、本番環境のワークロードに対してインテリジェントなパフォーマンス最適化を実装します。

using IronOcr;
using System;

// Configure IronTesseract for optimal performance
var ocr = new IronTesseract();

// Performance optimization: disable unnecessary character recognition
// Speeds up processing by 20-30% when special characters aren't needed
ocr.Configuration.BlackListCharacters = "~`$#^*_}{][|\\@¢©«»°±·×‑–—''""•…′″€™←↑→↓↔⇄⇒∅∼≅≈≠≤≥≪≫⌁⌘○◔◑◕●";

// Use automatic page segmentation for faster processing
// Adapts to document layout without manual configuration
ocr.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.Auto;

// Disable barcode scanning when not needed
// Eliminates unnecessary processing overhead
ocr.Configuration.ReadBarCodes = false;

// Switch to fast language pack for speed-critical applications
// Trades minimal accuracy for 40% performance improvement
ocr.Language = OcrLanguage.EnglishFast;

// Load and process documents efficiently
using var input = new OcrInput();
var pageIndices = new int[] { 1, 2 };
input.LoadImageFrames(@"img\Potter.tiff", pageIndices);

// Multi-threaded processing utilizes all CPU cores
// Automatically scales based on system capabilities
var result = ocr.Read(input);

Console.WriteLine(result.Text);

// Performance monitoring capabilities:
// - result.TimeToRead: Processing duration
// - result.InputDetails: Image analysis metrics
// - Memory-efficient streaming for large documents
using IronOcr;
using System;

// Configure IronTesseract for optimal performance
var ocr = new IronTesseract();

// Performance optimization: disable unnecessary character recognition
// Speeds up processing by 20-30% when special characters aren't needed
ocr.Configuration.BlackListCharacters = "~`$#^*_}{][|\\@¢©«»°±·×‑–—''""•…′″€™←↑→↓↔⇄⇒∅∼≅≈≠≤≥≪≫⌁⌘○◔◑◕●";

// Use automatic page segmentation for faster processing
// Adapts to document layout without manual configuration
ocr.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.Auto;

// Disable barcode scanning when not needed
// Eliminates unnecessary processing overhead
ocr.Configuration.ReadBarCodes = false;

// Switch to fast language pack for speed-critical applications
// Trades minimal accuracy for 40% performance improvement
ocr.Language = OcrLanguage.EnglishFast;

// Load and process documents efficiently
using var input = new OcrInput();
var pageIndices = new int[] { 1, 2 };
input.LoadImageFrames(@"img\Potter.tiff", pageIndices);

// Multi-threaded processing utilizes all CPU cores
// Automatically scales based on system capabilities
var result = ocr.Read(input);

Console.WriteLine(result.Text);

// Performance monitoring capabilities:
// - result.TimeToRead: Processing duration
// - result.InputDetails: Image analysis metrics
// - Memory-efficient streaming for large documents
Imports IronOcr
Imports System

' Configure IronTesseract for optimal performance
Private ocr = New IronTesseract()

' Performance optimization: disable unnecessary character recognition
' Speeds up processing by 20-30% when special characters aren't needed
ocr.Configuration.BlackListCharacters = "~`$#^*_}{][|\@¢©«»°±·×‑–—''""•…′″€™←↑→↓↔⇄⇒∅∼≅≈≠≤≥≪≫⌁⌘○◔◑◕●"

' Use automatic page segmentation for faster processing
' Adapts to document layout without manual configuration
ocr.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.Auto

' Disable barcode scanning when not needed
' Eliminates unnecessary processing overhead
ocr.Configuration.ReadBarCodes = False

' Switch to fast language pack for speed-critical applications
' Trades minimal accuracy for 40% performance improvement
ocr.Language = OcrLanguage.EnglishFast

' Load and process documents efficiently
Dim input = New OcrInput()
Dim pageIndices = New Integer() { 1, 2 }
input.LoadImageFrames("img\Potter.tiff", pageIndices)

' Multi-threaded processing utilizes all CPU cores
' Automatically scales based on system capabilities
Dim result = ocr.Read(input)

Console.WriteLine(result.Text)

' Performance monitoring capabilities:
' - result.TimeToRead: Processing duration
' - result.InputDetails: Image analysis metrics
' - Memory-efficient streaming for large documents
$vbLabelText   $csharpLabel

これらの最適化は、IronOCR の製品版対応設計を実証しています。 特殊文字が不要な場合、 BlackListCharacters構成だけで速度が 20 ~ 30% 向上します。 高速言語パックは、完璧な精度が重要ではない大量処理に優れたバランスを提供します。

エンタープライズ アプリケーションの場合、IronOCR のマルチスレッド サポートにより、複数のドキュメントを同時に処理することができ、シングル スレッドの Tesseract と比較して、最新のマルチコア システムで 4 ~ 8 倍のスループットの向上を実現します。

Tesseract と IronOCR の API 設計の違いは何ですか?

.NET での Google Tesseract OCR

生の Tesseract を C# アプリケーションに統合するには、次の 2 つの難しいオプションがあります。

-相互運用ラッパー: 時代遅れで、ドキュメントが不十分で、メモリリークが発生しやすい -コマンドライン実行: 導入が難しく、セキュリティポリシーによってブロックされ、エラー処理が不十分

どちらのアプローチも、クラウド環境、Web アプリケーション、またはクロスプラットフォーム展開では確実に機能しません。 適切な .NET 統合がないと、ビジネス上の問題を解決するよりも、ツールと格闘する時間の方が長くなります。

IronOCR .NET用Tesseract OCRライブラリ

IronOCR は、.NET 開発者向けに特別に設計された、完全に管理された直感的な API を提供します。

最もシンプルな実装

using IronOcr;

// Initialize the OCR engine with full IntelliSense support
var ocr = new IronTesseract();

// Process an image with automatic format detection
// Handles JPEG, PNG, TIFF, PDF, and more
var result = ocr.Read("img.png");

// Extract text with confidence metrics
string extractedText = result.Text;
Console.WriteLine(extractedText);

// Rich API provides detailed results:
// - result.Confidence: Overall accuracy percentage
// - result.Pages: Page-by-page breakdown
// - result.Paragraphs: Document structure
// - result.Words: Individual word details
// - result.Barcodes: Detected barcode values
using IronOcr;

// Initialize the OCR engine with full IntelliSense support
var ocr = new IronTesseract();

// Process an image with automatic format detection
// Handles JPEG, PNG, TIFF, PDF, and more
var result = ocr.Read("img.png");

// Extract text with confidence metrics
string extractedText = result.Text;
Console.WriteLine(extractedText);

// Rich API provides detailed results:
// - result.Confidence: Overall accuracy percentage
// - result.Pages: Page-by-page breakdown
// - result.Paragraphs: Document structure
// - result.Words: Individual word details
// - result.Barcodes: Detected barcode values
Imports IronOcr

' Initialize the OCR engine with full IntelliSense support
Private ocr = New IronTesseract()

' Process an image with automatic format detection
' Handles JPEG, PNG, TIFF, PDF, and more
Private result = ocr.Read("img.png")

' Extract text with confidence metrics
Private extractedText As String = result.Text
Console.WriteLine(extractedText)

' Rich API provides detailed results:
' - result.Confidence: Overall accuracy percentage
' - result.Pages: Page-by-page breakdown
' - result.Paragraphs: Document structure
' - result.Words: Individual word details
' - result.Barcodes: Detected barcode values
$vbLabelText   $csharpLabel

この合理化された API により、従来の Tesseract 統合の複雑さが解消されます。 各メソッドには包括的なXMLドキュメントが付属しており、IDE内で直接機能を簡単に確認できます。充実したAPIドキュメントには、各機能の詳細な例が掲載されています。

経験豊富なエンジニアによる専門的なサポートにより、実装の詳細で行き詰まることはありません。 ライブラリは定期的に更新され、最新の .NET リリースとの互換性を維持しながら、開発者のフィードバックに基づいて新しい機能が追加されます。

どのプラットフォームと展開シナリオがサポートされていますか?

Google Tesseract + .NET 向け相互運用性

クロスプラットフォームの Tesseract デプロイメントには、プラットフォーム固有のビルドと構成が必要です。

各ターゲット環境には、異なるバイナリ、ランタイム依存関係、および権限が必要です。 Docker コンテナでは、ベースイメージを慎重に選択する必要があります。 Visual C++ ランタイムが不足しているために、Azure のデプロイメントが失敗することがよくあります。 Linux の互換性は、特定のディストリビューションとパッケージの可用性によって異なります。

IronOCR Tesseract .NET OCRライブラリ

IronOCR は、真の一度の書き込みでどこにでも展開できる機能を提供します。

アプリケーションの種類:

  • デスクトップ アプリケーション (WPF、WinForms、コンソール)
  • Web アプリケーション (ASP.NET Core、Blazor)
  • クラウドサービス(Azure Functions、AWS Lambda)
  • モバイルアプリ(Xamarin経由)
  • マイクロサービス(Docker、Kubernetes)

プラットフォームサポート:

  • Windows (7、8、10、11、Server エディション)
  • macOS (IntelとApple Silicon)
  • Linux (Ubuntu、Debian、CentOS、Alpine)
  • Dockerコンテナ(公式ベースイメージ)
  • クラウド プラットフォーム (Azure、AWS、Google Cloud)

.NET 互換性:

  • .NET Framework 4.6.2 以上
  • .NET Core 2.0+ (すべてのバージョン)
  • .NET 5、6、7、8、9、10
  • .NET Standard 2.0 以上
  • Monoフレームワーク
  • Xamarin.Mac

ライブラリはプラットフォームの違いを内部的に処理し、すべての環境で一貫した結果を提供します。 デプロイメント ガイドでは、コンテナ化、サーバーレス関数、高可用性構成などの特定のシナリオについて説明します。

多言語 OCR 機能の比較

Google Tesseract 言語サポート

生の Tesseract で言語を管理するには、tessdata ファイル (すべての言語で約 4 GB) をダウンロードして維持する必要があります。

フォルダ構造は正確で、環境変数は適切に設定され、実行時にパスにアクセス可能でなければなりません。言語切り替えにはファイルシステムへのアクセスが必要となるため、制限された環境での展開は複雑になります。 Tesseract バイナリと言語ファイル間のバージョンの不一致により、不可解なエラーが発生します。

IronOCR 言語管理

IronOCR は NuGet パッケージ管理を通じて言語サポートに革命をもたらします。

アラビア語OCRの例

using IronOcr;

// Configure IronTesseract for Arabic text recognition
var ocr = new IronTesseract
{
    // Set primary language to Arabic
    // Automatically handles right-to-left text
    Language = OcrLanguage.Arabic
};

// Load Arabic documents for processing
using var input = new OcrInput();
var pageIndices = new int[] { 1, 2 };
input.LoadImageFrames("img/arabic.gif", pageIndices);

// IronOCR includes specialized preprocessing for Arabic scripts
// Handles cursive text and diacritical marks automatically

// Perform OCR with language-specific optimizations
var result = ocr.Read(input);

// Save results with proper Unicode encoding
// Preserves Arabic text formatting and direction
result.SaveAsTextFile("arabic.txt");

// Advanced Arabic features:
// - Mixed Arabic/English document support
// - Automatic number conversion (Eastern/Western Arabic)
// - Font-specific optimization for common Arabic typefaces
using IronOcr;

// Configure IronTesseract for Arabic text recognition
var ocr = new IronTesseract
{
    // Set primary language to Arabic
    // Automatically handles right-to-left text
    Language = OcrLanguage.Arabic
};

// Load Arabic documents for processing
using var input = new OcrInput();
var pageIndices = new int[] { 1, 2 };
input.LoadImageFrames("img/arabic.gif", pageIndices);

// IronOCR includes specialized preprocessing for Arabic scripts
// Handles cursive text and diacritical marks automatically

// Perform OCR with language-specific optimizations
var result = ocr.Read(input);

// Save results with proper Unicode encoding
// Preserves Arabic text formatting and direction
result.SaveAsTextFile("arabic.txt");

// Advanced Arabic features:
// - Mixed Arabic/English document support
// - Automatic number conversion (Eastern/Western Arabic)
// - Font-specific optimization for common Arabic typefaces
Imports IronOcr

' Configure IronTesseract for Arabic text recognition
Private ocr = New IronTesseract With {.Language = OcrLanguage.Arabic}

' Load Arabic documents for processing
Private input = New OcrInput()
Private pageIndices = New Integer() { 1, 2 }
input.LoadImageFrames("img/arabic.gif", pageIndices)

' IronOCR includes specialized preprocessing for Arabic scripts
' Handles cursive text and diacritical marks automatically

' Perform OCR with language-specific optimizations
Dim result = ocr.Read(input)

' Save results with proper Unicode encoding
' Preserves Arabic text formatting and direction
result.SaveAsTextFile("arabic.txt")

' Advanced Arabic features:
' - Mixed Arabic/English document support
' - Automatic number conversion (Eastern/Western Arabic)
' - Font-specific optimization for common Arabic typefaces
$vbLabelText   $csharpLabel

多言語ドキュメント処理

using IronOcr;

// Install language packs via NuGet:
// PM> Install-Package IronOcr.Languages.ChineseSimplified

// Configure multi-language OCR
var ocr = new IronTesseract();

// Set primary language for majority content
ocr.Language = OcrLanguage.ChineseSimplified;

// Add secondary language for mixed content
// Perfect for documents with Chinese text and English metadata
ocr.AddSecondaryLanguage(OcrLanguage.English);

// Process multi-language PDFs efficiently
using var input = new OcrInput();
input.LoadPdf("multi-language.pdf");

// IronOCR automatically detects and switches between languages
// Maintains high accuracy across language boundaries
var result = ocr.Read(input);

// Export preserves all languages correctly
result.SaveAsTextFile("results.txt");

// Supported scenarios:
// - Technical documents with English terms in foreign text
// - Multilingual forms and applications  
// - International business documents
// - Mixed-script content (Latin, CJK, Arabic, etc.)
using IronOcr;

// Install language packs via NuGet:
// PM> Install-Package IronOcr.Languages.ChineseSimplified

// Configure multi-language OCR
var ocr = new IronTesseract();

// Set primary language for majority content
ocr.Language = OcrLanguage.ChineseSimplified;

// Add secondary language for mixed content
// Perfect for documents with Chinese text and English metadata
ocr.AddSecondaryLanguage(OcrLanguage.English);

// Process multi-language PDFs efficiently
using var input = new OcrInput();
input.LoadPdf("multi-language.pdf");

// IronOCR automatically detects and switches between languages
// Maintains high accuracy across language boundaries
var result = ocr.Read(input);

// Export preserves all languages correctly
result.SaveAsTextFile("results.txt");

// Supported scenarios:
// - Technical documents with English terms in foreign text
// - Multilingual forms and applications  
// - International business documents
// - Mixed-script content (Latin, CJK, Arabic, etc.)
Imports IronOcr

' Install language packs via NuGet:
' PM> Install-Package IronOcr.Languages.ChineseSimplified

' Configure multi-language OCR
Private ocr = New IronTesseract()

' Set primary language for majority content
ocr.Language = OcrLanguage.ChineseSimplified

' Add secondary language for mixed content
' Perfect for documents with Chinese text and English metadata
ocr.AddSecondaryLanguage(OcrLanguage.English)

' Process multi-language PDFs efficiently
Dim input = New OcrInput()
input.LoadPdf("multi-language.pdf")

' IronOCR automatically detects and switches between languages
' Maintains high accuracy across language boundaries
Dim result = ocr.Read(input)

' Export preserves all languages correctly
result.SaveAsTextFile("results.txt")

' Supported scenarios:
' - Technical documents with English terms in foreign text
' - Multilingual forms and applications  
' - International business documents
' - Mixed-script content (Latin, CJK, Arabic, etc.)
$vbLabelText   $csharpLabel

言語パック システムは127 を超える言語をサポートしており、各言語は特定のスクリプトと表記体系に最適化されています。 NuGet を介したインストールにより、バージョンの互換性が確保され、さまざまな環境間での展開が簡素化されます。

IronOCR は基本的な OCR 以外にどのような追加機能を提供しますか?

IronOCR は、基本的なテキスト抽出をはるかに超えて、エンタープライズ対応の機能を備えています。

-自動画像解析:画像特性に基づいてインテリジェントに処理を構成する -検索可能なPDF作成:スキャンした文書を完全に検索可能なPDFに変換します -高度なPDF OCR :文書構造を維持しながらテキストを抽出 -バーコードとQRコードの読み取り:同じパスでバーコードを検出してデコードします

  • HTMLエクスポート:OCR結果から構造化されたHTMLを生成します
  • TIFFからPDFへの変換:複数ページのTIFFを検索可能なPDFに変換します -マルチスレッドサポート:複数のドキュメントを同時に処理 -詳細な結果分析:信頼スコア付きの文字レベルのデータにアクセス

OcrResultクラスは、認識されたコンテンツへのきめ細かなアクセスを提供し、高度な後処理および検証ワークフローを可能にします。

C# 開発にはどの OCR ソリューションを選択すべきでしょうか?

C# OCR 用 Google Tesseract

次の場合にはバニラ Tesseract を選択します。

  • 学術プロジェクトや研究プロジェクトに取り組んでいる
  • 無制限の開発時間で完璧にスキャンされた文書を処理
  • 概念実証アプリケーションの構築
  • 考慮すべきはコストのみ

重大な統合の課題と継続的なメンテナンス要件に備えてください。

IronOCR .NET Framework & Core 用 Tesseract OCR ライブラリ

IronOCR は次の場合に最適です。

  • 信頼性が求められる生産アプリケーション
  • 現実世界のドキュメント品質のプロジェクト
  • クロスプラットフォーム展開
  • 時間的に厳しい開発スケジュール
  • 専門家のサポートを必要とするアプリケーション

このライブラリは、開発時間の短縮と難しいドキュメントの優れた精度により、投資を回収します。

C# プロジェクトでプロフェッショナル OCR を始めるにはどうすればよいでしょうか?

Visual Studio プロジェクトで高精度 OCR の実装を開始します。

Install-Package IronOcr

または、 IronOCR .NET DLL を直接ダウンロードして手動でインストールします。

弊社の包括的な入門ガイドから始めて、コード例を調べ、必要に応じて専門家のサポートを活用してください。

プロフェッショナル OCR がもたらす違いを体験してください。今すぐ無料トライアルを開始し、ドキュメント処理ワークフローで 99.8% 以上の精度を達成している 10,000 社以上の企業に加わってください。

Logos of major companies including NASA, LEGO, and 3M that trust Iron Software products for their OCR needs Iron Software OCRテクノロジーは、世界中のフォーチュン500企業や政府機関から、ミッションクリティカルな文書処理に信頼されています。

他の OCR サービスとの詳細な比較については、当社の分析"AWS Textract と Google Vision OCR - エンタープライズ機能の比較"をご覧ください。

よくある質問

C#アプリケーションでTesseract OCRを実装するにはどうすればよいですか?

C#アプリケーションでTesseract OCRを実装するには、IronOCRの IronTesseract クラスを使用できます。NuGetで Install-Package IronOcr コマンドを使用してインストールし、名前空間 using IronOcr; を追加します。var ocr = new IronTesseract(); でOCRエンジンをインスタンス化し、var result = ocr.Read("image.png"); を使用して画像からテキストを抽出します。

IronOCRが従来のTesseractよりも優れている点は何ですか?

IronOCRは従来のTesseractに比べて、多くの利点があります。これには、ネイティブの依存関係なしでの簡素化された展開、自動画像前処理による精度の向上、.NETとの統合などが含まれます。IronOCRは、PDFや多言語サポートなどの機能を提供し、NuGetを通して簡単にインストールでき、通常のTesseractで必要とされる複雑なC++インタロップを避けることができます。

C#プロジェクトでOCRの精度を向上させるにはどうすればよいですか?

C#プロジェクトでのOCRの精度を向上させるには、IronOCRの自動画像強化機能を使用します。input.DeNoise()input.Deskew()などのメソッドは、画像を前処理するのに役立ち、ノイズを減らし、歪みを修正します。さらに、適切な言語設定を選択し、OcrResult.Confidenceを使用して精度検証のための信頼度メトリックを利用してください。

C#を使用してPDFドキュメントにOCRを適用することはできますか?

はい、IronOCRの OcrInput クラスを使用して、PDFドキュメントにOCRを適用することができます。input.LoadPdf("file.pdf", "password") を使用してPDFをロードし、var result = ocr.Read(input); で処理します。これにより、C#アプリケーション内で直接、検索可能なPDFを作成およびテキスト抽出が可能です。

単一のOCRドキュメントで複数の言語を処理するにはどうすればよいですか?

IronOCRを使用すると、単一のドキュメント内で複数の言語を処理することができます。ocr.Language = OcrLanguage.English; で主要な言語を設定し、ocr.AddSecondaryLanguage(OcrLanguage.Spanish); で二次言語を追加します。この柔軟性は、混在する言語や技術用語を含む文書に役立ちます。

IronOCRはどのプラットフォームでサポートされていますか?

IronOCRは、.NET Framework 4.6.2+、.NET Core 2.0+、.NET 5-10、.NET Standard 2.0+ など、幅広いプラットフォームをサポートしています。Windows、macOS、Linuxで動作し、また、Dockerコンテナ、Azure Functions、AWS Lambda、Xamarinモバイルアプリでも動作するため、異なる環境間で一貫したパフォーマンスを提供します。

C#でOCR処理のパフォーマンスを最適化するにはどうすればよいですか?

C#でOCR処理のパフォーマンスを最適化するには、IronOCRの機能を利用して、例えばocr.Configuration.ReadBarCodes = false;で不要なバーコードスキャンを無効にし、ocr.Language = OcrLanguage.EnglishFast;といった高速な言語モデルを選択します。さらにマルチスレッドの機能を活用して、より高速なバッチ処理が可能です。

IronOCRで対応している画像フォーマットは何ですか?

IronOCRは、PDF、TIFF、JPEG、PNGなどのさまざまな画像フォーマットに対応しています。OcrInput クラスを使用してinput.LoadImage("photo.jpg")input.LoadPdf("file.pdf") といった方法で画像をロードします。この広い互換性により、さまざまな画像ソースやフォーマットとの統合が簡単になります。

Jacob Mellor、Ironチームの最高技術責任者(CTO)
最高技術責任者(CTO)

Jacob Mellorは、Iron Softwareの最高技術責任者であり、C# PDF技術の開拓者としてその先進的な役割を担っています。Iron Softwareのコアコードベースのオリジナルデベロッパーである彼は、創業時から製品のアーキテクチャを形作り、CEOのCameron Rimingtonと協力してNASA、Tesla、全世界の政府機関を含む50人以上の会社に成長させました。

Jacobは、1998年から2001年にかけてマンチェスター大学で土木工学の第一級優等学士号(BEng)を取得しました。1999年にロンドンで最初のソフトウェアビジネスを立ち上げ、2005年には最初の.NETコンポーネントを作成し、Microsoftエコシステムにおける複雑な問題の解決を専門にしました。

彼の旗艦製品であるIronPDFとIronSuite .NETライブラリは、全世界で3000万以上のNuGetインストールを達成しており、彼の基本コードが世界中で使用されている開発者ツールを支えています。商業的な経験を25年間積み、コードを書くことを41年間続けるJacobは、企業向けのC#、Java、およびPython PDF技術の革新を推進し続け、次世代の技術リーダーを指導しています。

レビュー済み
Jeff Fritz
Jeffrey T. Fritz
プリンシパルプログラムマネージャー - .NETコミュニティチーム
Jeffはまた、.NETとVisual Studioチームのプリンシパルプログラムマネージャーです。彼は.NET Conf仮想会議シリーズのエグゼクティブプロデューサーであり、週に二回放送される開発者向けライブストリーム『Fritz and Friends』のホストを務め、テクノロジーについて話すことや視聴者と一緒にコードを書くことをしています。Jeffはワークショップ、プレゼンテーション、およびMicrosoft Build、Microsoft Ignite、.NET Conf、Microsoft MVPサミットを含む最大のMicrosoft開発者イベントのコンテンツを企画しています。
準備はできましたか?
Nuget ダウンロード 5,167,857 | Version: 2025.11 リリース