ホワイトペーパー

機械学習ソフトウェアを使用した画像からのテキスト抽出

TECHNOLOGY

\u6a5f\u68b0\u5b66\u7fd2\u3092\u4f7f\u7528\u3057\u3066\u30ad\u30e3\u30d7\u30c1\u30e3\u307e\u305f\u306f\u30b9\u30ad\u30e3\u30f3\u3055\u308c\u305f\u6587\u66f8\u304b\u3089\u30c6\u30ad\u30b9\u30c8\u3092\u62bd\u51fa\u3059\u308b\u3053\u3068\u306f\u3001\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30d3\u30b8\u30e7\u30f3\u3068\u81ea\u7136\u8a00\u8a9e\u51e6\u7406\u306e\u4ea4\u5dee\u70b9\u306b\u3042\u308b\u6025\u6210\u9577\u3057\u3066\u3044\u308b\u5206\u91ce\u3067\u3059\u3002 \u3053\u306e\u6280\u8853\u306f\u3001\u9ad8\u5ea6\u306a\u6a5f\u68b0\u5b66\u7fd2\u3001\u7269\u4f53\u8a8d\u8b58\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3001\u9ad8\u5ea6\u306a\u30b0\u30e9\u30d5\u30a3\u30c3\u30af\u30b9\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u3001\u30c7\u30a3\u30fc\u30d7\u30a6\u30a7\u30d6\u3068\u30c0\u30fc\u30af\u30a6\u30a7\u30d6\u3001\u304a\u3088\u3073\u30cb\u30e5\u30fc\u30e9\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u3092\u6d3b\u7528\u3057\u3066\u3001\u753b\u50cf\u3084\u30b9\u30ad\u30e3\u30f3\u3055\u308c\u305f\u7d19\u6587\u66f8\u304b\u3089\u30c6\u30ad\u30b9\u30c8\u60c5\u5831\u3092\u6b63\u78ba\u306b\u8b58\u5225\u3057\u62bd\u51fa\u3057\u307e\u3059\u3002 \u5149\u5b66\u6587\u5b57\u8a8d\u8b58\uff08OCR\uff09\u3084\u6df1\u5c64\u5b66\u7fd2\u3068\u3044\u3063\u305f\u3055\u307e\u3056\u307e\u306a\u6a5f\u68b0\u5b66\u7fd2\u6280\u8853\u3092\u7528\u3044\u308b\u3053\u3068\u3067\u3001\u81ea\u52d5\u5316\u3055\u308c\u52b9\u7387\u7684\u306a\u8996\u899a\u30b7\u30fc\u30f3\u30c6\u30ad\u30b9\u30c8\u691c\u51fa\u304b\u3089\u3001\u7de8\u96c6\u53ef\u80fd\u3067\u691c\u7d22\u53ef\u80fd\u306a\u69cb\u9020\u5316\u30c7\u30fc\u30bf\u3001\u53ca\u3073\u7269\u4f53\u691c\u51fa\u3078\u3068\u5909\u63db\u3092\u53ef\u80fd\u306b\u3057\u307e\u3059\u3002

\u3053\u306e\u9032\u5316\u3059\u308b\u74b0\u5883\u306e\u4e2d\u3067\u3001\u7814\u7a76\u8005\u3084\u5b9f\u52d9\u8005\u306f\u3001\u5370\u5237\u6587\u66f8\u306e\u30c7\u30b8\u30bf\u30eb\u5316\u3001\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u4ed8\u3051\u3001\u7ffb\u8a33\u3001\u30a2\u30af\u30bb\u30b7\u30d3\u30ea\u30c6\u30a3\u5411\u4e0a\u306a\u3069\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u304a\u3044\u3066\u91cd\u8981\u306a\u8981\u7d20\u3068\u306a\u308b\u3001\u753b\u50cf\u3084\u30b9\u30ad\u30e3\u30f3\u3055\u308c\u305f\u6587\u66f8\u304b\u3089\u306e\u30c6\u30ad\u30b9\u30c8\u691c\u51fa\u3068\u62bd\u51fa\u306e\u7cbe\u5ea6\u3001\u901f\u5ea6\u3001\u6c4e\u7528\u6027\u3092\u5411\u4e0a\u3055\u305b\u308b\u305f\u3081\u306b\u4e0d\u65ad\u306e\u52aa\u529b\u3092\u7d9a\u3051\u3066\u3044\u307e\u3059\u3002

この記事では、強力な機械学習アルゴリズムとテキスト関連の機能を備えたOCRライブラリであるIronOCRを使用して、画像からテキストを抽出する方法について説明します。 テキスト抽出、またはキーワード抽出は、機械学習に基づいて非構造化データや会社の中央データベースから関連性のあるまたは基本的な単語やフレーズを自動的にスキャンして抽出します。

機械学習を使用して画像からテキストを抽出する方法

  1. 画像からテキストを抽出するためのC#ライブラリをダウンロードします。
  2. 場面テキスト認識のためにOcrInputオブジェクトをインスタンス化して特定の画像を読み込みます。
  3. ocrTesseract.Readメソッドを使用して画像からデータを抽出します。
  4. Console.WriteLineメソッドを使用してコンソールに抽出されたテキストを印刷します。
  5. CropRectangleオブジェクトを使用して画像の領域でOCRを実行します。

IronOCR - 光学文字認識(OCR)ライブラリ

IronOCRは、画像やドキュメントからのテキスト抽出技術の最前線に立った著名かつ高度な光学文字認識(OCR)ソフトウェアです。 Iron Softwareによって開発されたこの強力なOCRエンジンは、スキャンされた画像、PDF、またはテキストの写真を編集可能で検索可能なデジタルコンテンツに正確かつ効率的に変換するように設計されています。 機械学習アルゴリズムとニューラルネットワークを巧みに活用することで、IronOCRはデータ抽出、コンテンツインデックス作成、および正確なテキスト認識を必要とする自動化プロセスを含むさまざまなアプリケーションのための堅牢なソリューションを提供します。

\u8907\u6570\u306e\u8a00\u8a9e\u3084\u591a\u69d8\u306a\u30d5\u30a9\u30f3\u30c8\u306b\u5bfe\u5fdc\u3067\u304d\u308b\u80fd\u529b\u306f\u3001\u3055\u307e\u3056\u307e\u306a\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u3084\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u304a\u3051\u308b\u52b9\u7387\u7684\u306a\u30c6\u30ad\u30b9\u30c8\u8a8d\u8b58\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u62bd\u51fa\u6a5f\u80fd\u3092\u6c42\u3081\u308b\u958b\u767a\u8005\u3084\u4f01\u696d\u306b\u3068\u3063\u3066\u3001\u591a\u7528\u9014\u306a\u30c4\u30fc\u30eb\u3068\u306a\u308a\u307e\u3059\u3002 IronOCRを使用して、構造化されていないデータを完全にスキャンされたページに変換するテキスト抽出アルゴリズムを使用する一般的なテキスト認識技術を使用して自動的にスキャンテキストを行うことができます。

IronOCRのインストール

IronOCRはNuGetパッケージマネージャーを使用してインストールが可能です。 以下はIronOCRをインストールする手順です:

  1. まず、新しいC# Visual Studioプロジェクトを作成するか、既存のプロジェクトを開きます。

Visual Studio

  1. プロジェクトが作成されたら、上部のメニューでツールに移動してNuGetパッケージマネージャーを選択し、ソリューションのNuGetパッケージマネージャーを選択します。

ツールメニュー

  1. 新しいウィンドウが画面に表示されます。 ブラウズタブに移動し、検索バーにIronOCRと書き込みます。
  2. IronOCRパッケージのリストが表示されます。 最新のものを選択し、インストールをクリックします。

IronOCR

  1. \u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u306b\u57fa\u3065\u3044\u3066\u6570\u79d2\u304b\u304b\u308a\u307e\u3059; \u305d\u306e\u5f8c\u3001IronOCR\u306f\u3042\u306a\u305f\u306eC#\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002

\u753b\u50cf\u304b\u3089\u7de8\u96c6\u53ef\u80fd\u3067\u691c\u7d22\u53ef\u80fd\u306a\u30c7\u30fc\u30bf\u3078\u306e\u30c6\u30ad\u30b9\u30c8\u691c\u51fa

IronOCRを使用すると、画像処理技術と機械学習を利用して簡単にテキストを抽出できます。 このセクションでは、IronOCRを使用して画像からテキストを抽出する方法について説明します。

using IronOcr;
using System;

// Create a new instance of the IronTesseract class
var ocrTesseract = new IronTesseract();

// Specify the image path and perform OCR on the image
using (var ocrInput = new OcrInput(@"images\image.png"))
{
    var ocrResult = ocrTesseract.Read(ocrInput);

    // Print the extracted text to the console
    Console.WriteLine(ocrResult.Text);
}
using IronOcr;
using System;

// Create a new instance of the IronTesseract class
var ocrTesseract = new IronTesseract();

// Specify the image path and perform OCR on the image
using (var ocrInput = new OcrInput(@"images\image.png"))
{
    var ocrResult = ocrTesseract.Read(ocrInput);

    // Print the extracted text to the console
    Console.WriteLine(ocrResult.Text);
}
Imports IronOcr
Imports System

' Create a new instance of the IronTesseract class
Private ocrTesseract = New IronTesseract()

' Specify the image path and perform OCR on the image
Using ocrInput As New OcrInput("images\image.png")
	Dim ocrResult = ocrTesseract.Read(ocrInput)

	' Print the extracted text to the console
	Console.WriteLine(ocrResult.Text)
End Using
$vbLabelText   $csharpLabel

ここに段階的な説明があります: ステップバイステップの説明は次のとおりです:

  1. ライブラリのインポート

    using IronOcr;
    using System;
    using IronOcr;
    using System;
    Imports IronOcr
    Imports System
    $vbLabelText   $csharpLabel

    コードは必要なライブラリをIronOCRと、一般的な機能のためのSystemネームスペースを含めることで始まります。

この行は、IronOCRによって提供されるOCRエンジンであるIronTesseractのインスタンスを作成します。

```csharp
var ocrTesseract = new IronTesseract();
```

**OcrInput**オブジェクトは、処理する画像へのパスと共にインスタンス化されます。

```csharp
using (var ocrInput = new OcrInput(@"images\image.png"))
```

**OcrInput**オブジェクトは、処理する画像へのパスで初期化されます。 3. **OCRの実行とテキストの抽出**:
  1. OCRを実行し、テキストを抽出する:

    var ocrResult = ocrTesseract.Read(ocrInput);
    var ocrResult = ocrTesseract.Read(ocrInput);
    Dim ocrResult = ocrTesseract.Read(ocrInput)
    $vbLabelText   $csharpLabel

    この行は、OcrInputオブジェクトを渡して、IronTesseractインスタンスのReadメソッドを呼び出します。 このメソッドは、提供された画像に対してOCRを実行し、テキストを抽出します。

  2. 抽出されたテキストの表示:

    Console.WriteLine(ocrResult.Text);
    Console.WriteLine(ocrResult.Text);
    Console.WriteLine(ocrResult.Text)
    $vbLabelText   $csharpLabel

    最後に、抽出されたテキストはConsole.WriteLineを使用してコンソールに出力され、画像から取得されたOCR結果が表示されます。

請求書

入力画像

請求書

出力

顧客請求書出力

画像の指定された領域でOCRを実行する

このC#コードは、光学文字認識(OCR)用のIronOCRライブラリを利用しています。 こちらがコード例です。

using IronOcr;
using IronSoftware.Drawing;
using System;

// Create a new instance of the IronTesseract class
var ocrTesseract = new IronTesseract();

// Specify the region on the image to be processed
using (var ocrInput = new OcrInput())
{
    var ContentArea = new CropRectangle(x: 20, y: 20, width: 400, height: 50);

    // Add the image with the defined content area
    ocrInput.AddImage("r3.png", ContentArea);

    // Perform OCR on the specified region and extract text
    var ocrResult = ocrTesseract.Read(ocrInput);

    // Print the extracted text to the console
    Console.WriteLine(ocrResult.Text);
}
using IronOcr;
using IronSoftware.Drawing;
using System;

// Create a new instance of the IronTesseract class
var ocrTesseract = new IronTesseract();

// Specify the region on the image to be processed
using (var ocrInput = new OcrInput())
{
    var ContentArea = new CropRectangle(x: 20, y: 20, width: 400, height: 50);

    // Add the image with the defined content area
    ocrInput.AddImage("r3.png", ContentArea);

    // Perform OCR on the specified region and extract text
    var ocrResult = ocrTesseract.Read(ocrInput);

    // Print the extracted text to the console
    Console.WriteLine(ocrResult.Text);
}
Imports IronOcr
Imports IronSoftware.Drawing
Imports System

' Create a new instance of the IronTesseract class
Private ocrTesseract = New IronTesseract()

' Specify the region on the image to be processed
Using ocrInput As New OcrInput()
	Dim ContentArea = New CropRectangle(x:= 20, y:= 20, width:= 400, height:= 50)

	' Add the image with the defined content area
	ocrInput.AddImage("r3.png", ContentArea)

	' Perform OCR on the specified region and extract text
	Dim ocrResult = ocrTesseract.Read(ocrInput)

	' Print the extracted text to the console
	Console.WriteLine(ocrResult.Text)
End Using
$vbLabelText   $csharpLabel

まず必要なライブラリ、IronOCRとSystemをインポートします。 OCRエンジンであるIronTesseractインスタンスが作成されます。 コードは、定義された領域に焦点を当てて、処理する画像内の特定のContentAreaをCropRectangleを使用して設定します。 この指定された領域内の画像("r3.png")はOCR処理のために追加されます。 OCRエンジンは、指定されたコンテンツ領域を読み取り、テキストを抽出し、抽出されたテキストはConsole.WriteLineを使用してコンソールに印刷されます。 出力

出力

出力

結論

画像からのテキスト抽出は、機械学習を通じて、特にIronOCRのような光学文字認識(OCR)ライブラリを利用することで、コンピュータビジョンと自然言語処理の交差点での変革的な一歩を意味します。 著名なOCRライブラリとしてIronOCRは、この融合の可能性を示しており、複数の言語とフォントスタイルにわたってスキャン済みの画像やPDFをデジタルで編集可能なコンテンツに正確に変換することに卓越しています。

IronOCRは、著名なOCRライブラリとして、この融合の可能性を実証し、スキャンした画像やPDFを複数の言語とフォントスタイルでデジタル編集可能なコンテンツに正確に変換することに優れています。 IronOCRと関連するすべての機能についてもっと知るには、このリンクこちらを参照してください。

画像からテキストを抽出する完全なチュートリアルは、次のリンクで入手できます。 IronOCRのライセンスは、このリンクから購入できます。 IronOCR ライセンスはこのリンクから購入できます。