OCRツール

Windows OCRエンジン対Tesseract(OCR機能の比較)

更新済み 4月 3, 2024
共有:

現代のデジタル時代において、光学文字認識 (Optical Character Recognition, OCR) (OCR (光学式文字認識)) 技術は様々な業界に不可欠なものとなり、画像およびスキャンされた文書を編集可能で検索可能なテキストに変換することを可能にしています。

多くのOCRソフトウェアの中で、Google Cloud Visionのような (クラウドビジョンAPI)Adobe Acrobat Pro DC、ABBYY Finereader など多数、Windows OCRエンジン対Tesseract、および IronOCR 目立つ存在として際立っており、それぞれが文書分析を支援するための独自の機能と能力を提供しています。

この記事は、これらの3つのOCRエンジンについて、正確性、パフォーマンス、および統合のしやすさを評価し、包括的な比較分析を提供することを目的としています。

1. OCRエンジンの紹介

OCRエンジンは、画像、PDF、およびその他のスキャンされたドキュメントからプレーンテキストを認識して抽出するために設計されたソフトウェアツールです。 彼らは高度なアルゴリズムと機械学習技術を使用して文字を正確に識別し、機械で読み取り可能なテキストファイルに変換します。Windows OCR Engine、Tesseract、そしてIronOCRは、それぞれに強みと用途がある広く使用されている3つのOCRソリューションを表します。

2. Windows OCRエンジン

について Windows OCRエンジンWindowsオペレーティングシステムに統合され、入力画像やスキャンされたドキュメントからテキストを抽出するための便利で使いやすいソリューションを提供します。 高度な画像処理技術を活用することで、さまざまな言語やフォントスタイルのテキストを正確に認識することができます。 Windows OCR エンジンは、Windows Runtime 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;
class Program
{
    static async Task Main(string [] args)
    {
        // Provide the path to the image file
        string imagePath = "sample.png";
        try
        {
            // Instantiate the program class
            Program program = new Program();
            // Call the ExtractText method to extract text from the image
            string extractedText = await program.ExtractText(imagePath);
            // Display the extracted text
            Console.WriteLine("Extracted Text:");
            Console.WriteLine(extractedText);
        }
        catch (Exception ex)
        {
            Console.WriteLine("An error occurred: " + ex.Message);
        }
    }
    public 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 = System.IO.File.OpenRead(image))
            {
                Console.WriteLine("Extracted Text:");
                // Create a BitmapDecoder from the image file stream
                var bmpDecoder = await Windows.Graphics.Imaging.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 = Windows.Media.Ocr.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)
        {
            throw ex; // Propagate the exception
        }
        // Return the extracted text
        return text.ToString();
    }
}
using System;
using System.IO;
using System.Text;
using System.Threading.Tasks;
class Program
{
    static async Task Main(string [] args)
    {
        // Provide the path to the image file
        string imagePath = "sample.png";
        try
        {
            // Instantiate the program class
            Program program = new Program();
            // Call the ExtractText method to extract text from the image
            string extractedText = await program.ExtractText(imagePath);
            // Display the extracted text
            Console.WriteLine("Extracted Text:");
            Console.WriteLine(extractedText);
        }
        catch (Exception ex)
        {
            Console.WriteLine("An error occurred: " + ex.Message);
        }
    }
    public 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 = System.IO.File.OpenRead(image))
            {
                Console.WriteLine("Extracted Text:");
                // Create a BitmapDecoder from the image file stream
                var bmpDecoder = await Windows.Graphics.Imaging.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 = Windows.Media.Ocr.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)
        {
            throw ex; // Propagate the exception
        }
        // Return the extracted text
        return text.ToString();
    }
}
Imports System
Imports System.IO
Imports System.Text
Imports System.Threading.Tasks
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
			' Instantiate the program class
			Dim program As New Program()
			' Call the ExtractText method to extract text from the image
			Dim extractedText As String = Await program.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 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 = System.IO.File.OpenRead(image)
				Console.WriteLine("Extracted Text:")
				' Create a BitmapDecoder from the image file stream
				Dim bmpDecoder = Await Windows.Graphics.Imaging.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 = Windows.Media.Ocr.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
			Throw ex ' Propagate the exception
		End Try
		' Return the extracted text
		Return text.ToString()
	End Function
End Class
VB   C#

2.2.1 出力

Windows OCRエンジン vs Tesseract (OCR機能比較): 図1 - Windows OCRエンジンコードのコンソール出力

3. テッセラクト

テッセラクトGoogleによって開発されたオープンソースのOCRエンジンである、はその精度と多用途性により広く普及しています。 100以上の言語をサポートし、TIFF、JPEG、PNGを含む様々な画像フォーマットを処理できます。 Tesseract OCRエンジンは、ディープラーニングアルゴリズムとニューラルネットワークを活用して高いテキスト認識精度を実現し、幅広い用途に適しています。

3.1 Tesseractの主な機能

  • 言語サポート: Tesseract エンジンは、アラビア語や中国語のような複雑なスクリプトを含む100以上の言語をサポートしています。
  • 画像前処理: テキスト認識の精度を向上させるために、デスキュー、二値化、ノイズ除去などの広範な画像前処理機能を提供します。

  • カスタマイズオプション: Tesseractは、ユーザーがOCRパラメータを微調整し、特定のユースケースに合わせたカスタムモデルをトレーニングすることを可能にし、精度とパフォーマンスを向上させます。

3.2 コード例

using Patagames.Ocr;
using (var api = OcrApi.Create())
{
    api.Init(Patagames.Ocr.Enums.Languages.English);
    string plainText = api.GetTextFromImage(@"C:\Users\buttw\source\repos\ironqr\ironqr\bin\Debug\net5.0\Iron.png");
    Console.WriteLine(plainText);
}
using Patagames.Ocr;
using (var api = OcrApi.Create())
{
    api.Init(Patagames.Ocr.Enums.Languages.English);
    string plainText = api.GetTextFromImage(@"C:\Users\buttw\source\repos\ironqr\ironqr\bin\Debug\net5.0\Iron.png");
    Console.WriteLine(plainText);
}
Imports Patagames.Ocr
Using api = OcrApi.Create()
	api.Init(Patagames.Ocr.Enums.Languages.English)
	Dim plainText As String = api.GetTextFromImage("C:\Users\buttw\source\repos\ironqr\ironqr\bin\Debug\net5.0\Iron.png")
	Console.WriteLine(plainText)
End Using
VB   C#

3.2.1 出力

Windows OCRエンジンとTesseractの比較 (OCR機能比較): 図2 - Tesseractコードのコンソール出力

4. IronOCR

IronOCRは、開発者が.NETアプリケーションでOCR(光学文字認識)機能を組み込むための強力で使いやすいライブラリです。このツールは、画像やPDFドキュメントからテキスト情報を抽出する際の精度とスピードを高めるために設計されています。IronOCRはさまざまな言語とフォーマットをサポートし、カスタマイズ可能なオプションを提供します。

主な特徴:

  • 多言語対応:IronOCRは多数の言語の文字認識に対応しています。
  • 高性能:優れた精度で文字認識を実現し、誤認識を最小限に抑えます。
  • 使いやすいAPI:直感的でシンプルなAPIにより、実装が容易です。
  • 画像前処理機能:画像のクオリティーを向上させ、OCRの精度を向上させます。
  • PDF & 画像対応:幅広い画像フォーマットとPDFドキュメントからテキストを抽出可能です。

IronOCR for .NETは、企業の様々なニーズに応えるために開発されており、デプロイも簡単です。このツールを活用することで、あなたのアプリケーションに高性能なOCR機能を迅速に組み込むことができます。

IronOCRIron Softwareによって開発された強力なOCRエンジンは、その卓越した精度、使いやすさ、多言語サポートで際立っています。 それはオンプレミスのOCR機能を提供し、127以上の言語をサポートするため、グローバルなアプリケーションに適しています。 IronOCRは、難しいシナリオにおいても正確な文字認識結果を提供するために、高度な機械学習アルゴリズムとクラウドビジョン技術を活用しています。

4.1 IronOCRの主な特徴

  • 高精度:IronOCRは、テキスト認識において業界トップクラスの精度を提供し、様々な種類の文書や言語に対して信頼性のある結果を確保します。
  • 多言語対応: 127以上の言語をサポートしており、シームレスな多言語テキスト認識を実現するために包括的な言語パックを提供します。

  • シンプルな統合: IronOCRは、直感的なAPIと豊富なドキュメントを備えた.NETアプリケーションとの簡単な統合を提供し、オリジナル画像の前処理および後処理を行ってテキストを抽出する開発プロセスを効率化します。

4.2 IronOCR のインストール

コード例に進む前に、NuGet パッケージ マネージャーを使用して IronOCR をインストールする方法を見てみましょう。

  1. Visual Studioで、ツールメニューに移動し、NuGetパッケージマネージャーを選択します。

    1. 新しい一覧が表示されます。ここで、ソリューションのためにNuGetパッケージマネージャーを選択してください。

    Windows OCRエンジン vs Tesseract (OCR機能の比較): 図3 - Visual Studio NuGetパッケージマネージャーの見つけ方

  2. 新しいウィンドウが表示されたら、「参照」タブに移動し、検索バーに「IronOCR」と入力してください。

    1. パッケージのリストが表示されます。最新のIronOCRパッケージを選択し、[インストール]をクリックしてください。

    Windows OCRエンジンとTesseractの比較(OCR機能の比較): 図4 - IronOCRパッケージのインストール

4.3 コード例 (C#)

using IronOcr;
var ocr = new IronTesseract();
ocr.Language = OcrLanguage.English;
var result = ocr.Read("C:\\Users\\buttw\\source\\repos\\ironqr\\ironqr\\bin\\Debug\\net5.0\\Iron.png");
Console.WriteLine(result.Text);
using IronOcr;
var ocr = new IronTesseract();
ocr.Language = OcrLanguage.English;
var result = ocr.Read("C:\\Users\\buttw\\source\\repos\\ironqr\\ironqr\\bin\\Debug\\net5.0\\Iron.png");
Console.WriteLine(result.Text);
Imports IronOcr
Private ocr = New IronTesseract()
ocr.Language = OcrLanguage.English
Dim result = ocr.Read("C:\Users\buttw\source\repos\ironqr\ironqr\bin\Debug\net5.0\Iron.png")
Console.WriteLine(result.Text)
VB   C#

4.3.1 出力

Windows OCR エンジンとTesseractの比較 (OCR機能の比較): 図5 - IronOCRコードのコンソール出力

比較評価

精度とパフォーマンス

  • Windows OCRエンジンおよびTesseractは、適度な精度を提供しますが、複雑なレイアウトや手書きのテキストには苦労する場合があります。
  • IronOCR: 正確性に優れ、手書きのテキストやノイズの多い画像を含む、さまざまな種類の文書や言語にわたって信頼性の高い結果を提供します。

5.2 統合の容易さ

  • Windows OCR エンジン: Windows アプリケーションとシームレスに統合されますが、カスタマイズ オプションが欠けています。
  • Tesseract: 統合には追加の設定と依存関係が必要ですが、広範なカスタマイズオプションを提供します。

  • IronOCR: 直感的なAPIと包括的なドキュメントにより、.NETアプリケーションへの統合が簡単に行えます。

5.3 言語サポート

  • Windows OCRエンジンとTesseractは、TesseractおよびIronOCRと比較して対応している言語の数が限られています。
  • IronOCR: 127以上の言語をサポートしており、グローバルなアプリケーションに適しています。

    6. 結論

    結論として、Windows OCR EngineやTesseractはテキスト認識のための人気のある選択肢ですが、 IronOCR 最高の精度と柔軟性を誇るOCRエンジンとして登場します。業界をリードする精度、広範な言語サポート、および簡単な統合により、IronOCRは信頼できるOCR機能を求める企業や開発者にとって優れたソリューションとなります。 IronOCRを活用することで、組織は文書処理ワークフローの効率化、データ抽出精度の向上、およびスキャンされた文書や画像から貴重な洞察を引き出すことができます。

    IronOCRはを提供します 無料体験. IronOCRとその機能についての詳細は、次のURLをご覧ください。 [以下の内容を日本語に翻訳します:

ここに

ご希望のイディオムや技術用語が追加されることによって、より適切な翻訳が提供できる場合もありますので、詳細なコンテキストを教えていただけると幸いです。](/csharp/ocr/docs/).

< 以前
クラウドベースのOCR(OCR機能比較)
次へ >
Azure OCR 対 Google OCR (OCR機能の比較)

準備はできましたか? バージョン: 2024.9 新発売

無料のNuGetダウンロード 総ダウンロード数: 2,290,361 View Licenses >