Windows OCRエンジン対Tesseract:詳細な比較
今日のデジタル時代では、光学式文字認識 (OCR) 技術はさまざまな業界に不可欠なものとなり、画像やスキャンした文書を編集可能かつ検索可能なテキストに変換できるようになりました。
利用可能な数多くの OCR ソフトウェアの中で、Google Cloud Vision (Cloud Vision API)、Adobe Acrobat Pro DC、ABBYY Finereader、Windows OCR Engine、Tesseract、 IronOCRなどが有力候補として挙げられます。それぞれがドキュメント分析を支援する独自の機能を備えています。
この記事の目的は、これら 3 つの OCR エンジンの精度、パフォーマンス、統合の容易さを評価しながら、包括的な比較分析を提供することです。
1. OCRエンジンの紹介
OCR エンジンは、画像、PDF、その他のスキャンされたドキュメントからプレーンテキストを認識して抽出するように設計されたソフトウェア ツールです。 高度なアルゴリズムと機械学習技術を用いて文字を正確に識別し、機械が読み取り可能なテキストファイルに変換します。Windows OCR Engine、Tesseract、IronOCRは、それぞれに長所と用途があり、広く使用されている3つのOCRソリューションです。
2. Windows OCRエンジン
Windows オペレーティング システムに統合されたWindows OCR エンジンは、入力画像やスキャンしたドキュメントからテキストを抽出するための便利で使いやすいソリューションを提供します。 高度な画像処理技術を活用し、さまざまな言語やフォントスタイルのテキストを正確に認識できます。 Windows OCR エンジンは Windows ランタイム API を介してアクセス可能であり、コマンド ライン ツールの機能を使用して Windows アプリケーションにシームレスに統合できます。
2.1 Windows OCRエンジンの主な機能
-言語サポート: Windows OCRエンジンは多くの言語をサポートしているため、多言語文書に適しています。 -画像処理:高度な画像処理アルゴリズムを採用することで、低品質の画像でも印刷された文字の認識精度を向上させます。
- Windowsアプリケーションとの統合: Windows OCRエンジンはWindowsアプリケーションとシームレスに統合されるため、開発者はOCR機能をソフトウェアに完全に組み込むことができます。
2.2 コード例
using System;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using Windows.Graphics.Imaging;
using Windows.Media.Ocr;
class Program
{
static async Task Main(string[] args)
{
// Provide the path to the image file
string imagePath = "sample.png";
try
{
// Call the ExtractText method to extract text from the image
string extractedText = await ExtractText(imagePath);
// Display the extracted text
Console.WriteLine("Extracted Text:");
Console.WriteLine(extractedText);
}
catch (Exception ex)
{
Console.WriteLine("An error occurred: " + ex.Message);
}
}
public static async Task<string> ExtractText(string image)
{
// Initialize StringBuilder to store extracted text
StringBuilder text = new StringBuilder();
try
{
// Open the image file stream
using (var fileStream = File.OpenRead(image))
{
// Create a BitmapDecoder from the image file stream
var bmpDecoder = await BitmapDecoder.CreateAsync(fileStream.AsRandomAccessStream());
// Get the software bitmap from the decoder
var softwareBmp = await bmpDecoder.GetSoftwareBitmapAsync();
// Create an OCR engine from user profile languages
var ocrEngine = OcrEngine.TryCreateFromUserProfileLanguages();
// Recognize text from the software bitmap
var ocrResult = await ocrEngine.RecognizeAsync(softwareBmp);
// Append each line of recognized text to the StringBuilder
foreach (var line in ocrResult.Lines)
{
text.AppendLine(line.Text);
}
}
}
catch (Exception ex)
{
Console.WriteLine("Error during OCR process: " + ex.Message);
}
// Return the extracted text
return text.ToString();
}
}
using System;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using Windows.Graphics.Imaging;
using Windows.Media.Ocr;
class Program
{
static async Task Main(string[] args)
{
// Provide the path to the image file
string imagePath = "sample.png";
try
{
// Call the ExtractText method to extract text from the image
string extractedText = await ExtractText(imagePath);
// Display the extracted text
Console.WriteLine("Extracted Text:");
Console.WriteLine(extractedText);
}
catch (Exception ex)
{
Console.WriteLine("An error occurred: " + ex.Message);
}
}
public static async Task<string> ExtractText(string image)
{
// Initialize StringBuilder to store extracted text
StringBuilder text = new StringBuilder();
try
{
// Open the image file stream
using (var fileStream = File.OpenRead(image))
{
// Create a BitmapDecoder from the image file stream
var bmpDecoder = await BitmapDecoder.CreateAsync(fileStream.AsRandomAccessStream());
// Get the software bitmap from the decoder
var softwareBmp = await bmpDecoder.GetSoftwareBitmapAsync();
// Create an OCR engine from user profile languages
var ocrEngine = OcrEngine.TryCreateFromUserProfileLanguages();
// Recognize text from the software bitmap
var ocrResult = await ocrEngine.RecognizeAsync(softwareBmp);
// Append each line of recognized text to the StringBuilder
foreach (var line in ocrResult.Lines)
{
text.AppendLine(line.Text);
}
}
}
catch (Exception ex)
{
Console.WriteLine("Error during OCR process: " + ex.Message);
}
// Return the extracted text
return text.ToString();
}
}
Imports System
Imports System.IO
Imports System.Text
Imports System.Threading.Tasks
Imports Windows.Graphics.Imaging
Imports Windows.Media.Ocr
Friend Class Program
Shared Async Function Main(ByVal args() As String) As Task
' Provide the path to the image file
Dim imagePath As String = "sample.png"
Try
' Call the ExtractText method to extract text from the image
Dim extractedText As String = Await ExtractText(imagePath)
' Display the extracted text
Console.WriteLine("Extracted Text:")
Console.WriteLine(extractedText)
Catch ex As Exception
Console.WriteLine("An error occurred: " & ex.Message)
End Try
End Function
Public Shared Async Function ExtractText(ByVal image As String) As Task(Of String)
' Initialize StringBuilder to store extracted text
Dim text As New StringBuilder()
Try
' Open the image file stream
Using fileStream = File.OpenRead(image)
' Create a BitmapDecoder from the image file stream
Dim bmpDecoder = Await BitmapDecoder.CreateAsync(fileStream.AsRandomAccessStream())
' Get the software bitmap from the decoder
Dim softwareBmp = Await bmpDecoder.GetSoftwareBitmapAsync()
' Create an OCR engine from user profile languages
Dim ocrEngine = OcrEngine.TryCreateFromUserProfileLanguages()
' Recognize text from the software bitmap
Dim ocrResult = Await ocrEngine.RecognizeAsync(softwareBmp)
' Append each line of recognized text to the StringBuilder
For Each line In ocrResult.Lines
text.AppendLine(line.Text)
Next line
End Using
Catch ex As Exception
Console.WriteLine("Error during OCR process: " & ex.Message)
End Try
' Return the extracted text
Return text.ToString()
End Function
End Class
2.2.1 出力

3. Tesseract
Google が開発したオープンソースの OCR エンジンであるTesseract は、その精度と汎用性により幅広い人気を得ています。 100 以上の言語をサポートし、TIFF、JPEG、PNG などさまざまな画像形式を処理できます。 Tesseract OCR エンジンは、ディープラーニング アルゴリズムとニューラル ネットワークを採用して高いテキスト認識精度を実現し、幅広いアプリケーションに適しています。
3.1 Tesseractの主な特徴
-言語サポート: Tesseractエンジンは、アラビア語や中国語などの複雑な文字体系を含む100以上の言語をサポートしています。 -画像前処理:テキスト認識精度を向上させるため、傾き補正、二値化、ノイズ除去など、幅広い画像前処理機能を提供します。 -カスタマイズオプション: Tesseractでは、ユーザーがOCRパラメータを微調整し、特定のユースケースに合わせてカスタムモデルをトレーニングすることで、精度とパフォーマンスを向上させることができます。
3.2 コード例
using Patagames.Ocr;
class TesseractExample
{
static void Main(string[] args)
{
// Create an OCR API instance
using (var api = OcrApi.Create())
{
// Initialize the OCR engine for the English language
api.Init(Patagames.Ocr.Enums.Languages.English);
// Extract text from the image
string plainText = api.GetTextFromImage(@"C:\Users\buttw\source\repos\ironqr\ironqr\bin\Debug\net5.0\Iron.png");
// Display the extracted text
Console.WriteLine(plainText);
}
}
}
using Patagames.Ocr;
class TesseractExample
{
static void Main(string[] args)
{
// Create an OCR API instance
using (var api = OcrApi.Create())
{
// Initialize the OCR engine for the English language
api.Init(Patagames.Ocr.Enums.Languages.English);
// Extract text from the image
string plainText = api.GetTextFromImage(@"C:\Users\buttw\source\repos\ironqr\ironqr\bin\Debug\net5.0\Iron.png");
// Display the extracted text
Console.WriteLine(plainText);
}
}
}
Imports Patagames.Ocr
Friend Class TesseractExample
Shared Sub Main(ByVal args() As String)
' Create an OCR API instance
Using api = OcrApi.Create()
' Initialize the OCR engine for the English language
api.Init(Patagames.Ocr.Enums.Languages.English)
' Extract text from the image
Dim plainText As String = api.GetTextFromImage("C:\Users\buttw\source\repos\ironqr\ironqr\bin\Debug\net5.0\Iron.png")
' Display the extracted text
Console.WriteLine(plainText)
End Using
End Sub
End Class
3.2.1 出力

4. IronOCR
Iron Software が開発した強力な OCR エンジンである IronOCR は、優れた精度、使いやすさ、多様な言語サポートが特徴です。 オンプレミスの OCR 機能を提供し、125 以上の言語をサポートしているため、グローバル アプリケーションに適しています。 IronOCR は、高度な機械学習アルゴリズムとクラウド ビジョン テクノロジーを活用して、困難なシナリオでも正確なテキスト認識結果を提供します。
4.1 IronOCRの主な機能
-高精度: IronOCRは業界最高水準のテキスト認識精度を実現し、多様な文書の種類や言語において信頼性の高い結果を保証します。 -多彩な言語サポート: 125以上の言語をサポートし、シームレスな多言語テキスト認識のための包括的な言語パックを提供します。 -シンプルな統合: IronOCRは、直感的なAPIと豊富なドキュメントを備え、 .NETアプリケーションとの簡単な統合を提供します。これにより、テキストを抽出するための元の画像の事前処理と事後処理を含む開発プロセスを効率化できます。
4.2 IronOCRをインストールする
コーディング例に進む前に、NuGet パッケージ マネージャーを使用して IronOCR をインストールする方法を見てみましょう。
- Visual Studio で [ツール] メニューに移動し、[NuGet パッケージ マネージャー] を選択します。
- 新しいリストが表示されるので、ここでソリューションの NuGet パッケージ マネージャーを選択します。

- 新しいウィンドウが表示されるので、'Browse'タブに移動し、検索バーに'IronOCR'とタイプします。
- パッケージのリストが表示されます。 最新の IronOCR パッケージを選択し、インストールをクリックします。

4.3 コード例(C#)
using IronOcr;
class IronOCRExample
{
static void Main(string[] args)
{
// Create an IronTesseract instance
var ocr = new IronTesseract();
// Set the language for OCR recognition
ocr.Language = OcrLanguage.English;
// Perform OCR on the specified image
var result = ocr.Read(@"C:\Users\buttw\source\repos\ironqr\ironqr\bin\Debug\net5.0\Iron.png");
// Display the extracted text
Console.WriteLine(result.Text);
}
}
using IronOcr;
class IronOCRExample
{
static void Main(string[] args)
{
// Create an IronTesseract instance
var ocr = new IronTesseract();
// Set the language for OCR recognition
ocr.Language = OcrLanguage.English;
// Perform OCR on the specified image
var result = ocr.Read(@"C:\Users\buttw\source\repos\ironqr\ironqr\bin\Debug\net5.0\Iron.png");
// Display the extracted text
Console.WriteLine(result.Text);
}
}
Imports IronOcr
Friend Class IronOCRExample
Shared Sub Main(ByVal args() As String)
' Create an IronTesseract instance
Dim ocr = New IronTesseract()
' Set the language for OCR recognition
ocr.Language = OcrLanguage.English
' Perform OCR on the specified image
Dim result = ocr.Read("C:\Users\buttw\source\repos\ironqr\ironqr\bin\Debug\net5.0\Iron.png")
' Display the extracted text
Console.WriteLine(result.Text)
End Sub
End Class
4.3.1 出力

5. 比較評価
5.1 精度とパフォーマンス
- Windows OCR エンジンとTesseract は十分な精度を提供しますが、複雑なレイアウトでは苦労する可能性があります。
- IronOCR:精度に優れ、ノイズの多い画像を含む、多様な文書の種類や言語において信頼性の高い結果を提供します。
5.2 統合のしやすさ
- Windows OCRエンジン: Windowsアプリケーションとシームレスに統合されますが、カスタマイズオプションが不足しています。
- Tesseract:統合には追加の設定と依存関係が必要ですが、豊富なカスタマイズオプションを提供します。
- IronOCR:直感的なAPIと包括的なドキュメントを備え、 .NETアプリケーションとの簡単な統合を実現します。
5.3 言語サポート
- Windows OCR エンジンは、 Tesseract や IronOCR と比較して、サポートする言語の数が限られています。
- Tesseract: 100以上の言語をサポートしています。
- IronOCR: 125以上の言語をサポートしており、グローバルなアプリケーションに適しています。
6. 結論
結論として、Windows OCRエンジンとTesseractはテキスト認識の一般的な選択肢ですが、 IronOCRは最も正確で汎用性の高いOCRエンジンとして浮上しました。業界をリードする精度、幅広い言語サポート、そしてシンプルな統合により、信頼性の高いOCR機能を求める企業や開発者にとって、IronOCRは傑出したソリューションとなっています。 IronOCR を活用することで、組織はドキュメント処理ワークフローを合理化し、データ抽出の精度を高め、スキャンされたドキュメントや画像から貴重な洞察を引き出すことができます。




