IronOCRで手書きの画像を読む方法
IronOCRは、画像から手書きのテキストを確実にデジタル化する専門的なReadHandwritingメソッドを提供しており、不規則な間隔やストロークの変化という本質的な課題にもかかわらず、明確な英語の手書きで強力な結果を出しています。
- IronOCRと
IronOcr.Extensions.AdvancedScanパッケージをインストールします IronTesseractインスタンスを作成しますLoadImage()を使用して手書き画像を読み込みますReadHandwriting()メソッドを呼び出しますOcrResultから抽出されたテキストにアクセスします
-
1IronOCR を NuGet Package Manager でインストールします
-
2このコード スニペットをコピーして実行します。
using IronOcr; var ocrTesseract = new IronTesseract(); using var ocrInput = new OcrInput(); ocrInput.LoadImage("handwriting.png"); var ocrResult = ocrTesseract.ReadHandwriting(ocrInput); Console.WriteLine(ocrResult.Text);Imports IronOcr Dim ocrTesseract = New IronTesseract() Using ocrInput = New OcrInput() ocrInput.LoadImage("handwriting.png") Dim ocrResult = ocrTesseract.ReadHandwriting(ocrInput) Console.WriteLine(ocrResult.Text) End UsingImports IronOcr Dim ocrTesseract = New IronTesseract() Using ocrInput = New OcrInput() ocrInput.LoadImage("handwriting.png") Dim ocrResult = ocrTesseract.ReadHandwriting(ocrInput) Console.WriteLine(ocrResult.Text) End Using -
3実際の環境でテストするためにデプロイする
今日からご自身のプロジェクトでIronOCRを使い始めるには、無料トライアルをお試しください。
画像から手書きテキストを自動的に読み取ることは、人によって書き方が異なるため、非常に困難です。 この膨大な矛盾が、OCRを困難なものにしています。 古い記録、患者受け入れフォーム、顧客調査などの重要な文書では、依然として手作業による処理が必要なため、エラーの起こりやすいワークフローが発生し、データの完全性が損なわれています。
IronOCRは、手書き画像を確実に理解し、デジタル化する特別な方法を導入することで、この問題を解決します。 強力なTesseract 5エンジンをベースに、IronOCRは高度な画像処理と機械学習を組み合わせて、信頼性のある手書き認識機能を提供します。
このガイドでは、.NETアプリケーションに手書きOCRを実装する手順を順を追って説明します。歴史的文書のデジタル化、医療フォームの処理、手書きメモの変換など、IronOCRで信頼性の高い結果を得る方法を学ぶことができます。
IronOCRを使い始める
IronOCRを使って手書き画像を読み取る方法
- 手書き画像読み取り用のC#ライブラリをダウンロード
- OCRエンジンをインスタンス化する
LoadImageで手書き画像を読み込みます。ReadHandwritingメソッドを使用して、サンプルの手書き画像からデータを抽出します。- OcrResultプロパティにアクセスして、抽出されたデータを表示および操作します。
この機能を使用するには、まず IronOcr.Extensions.AdvancedScan パッケージをインストールする必要があります。 ReadHandwriting メソッドは現在英語のみをサポートしていることに注意してください。 複数言語の OCR の場合、適切な言語パックを使用して標準的な Read() メソッドを使用します。
IronOCRで手書きの画像を読むにはどうすればよいですか?
IronOCRで手書き画像を読むのは簡単です。 まず、OCRエンジンをインスタンス化し、次にLoadImageを使用して画像を読み込みます。そして最後に手書き認識用に設計されたReadHandwritingメソッドを利用します。 抽出したテキストを印刷し、正確さと内容を確認してください。
処理の前に、画像品質補正フィルターを適用して可読性を向上させることを検討してください。 これらのフィルタは、特にコントラストや解像度の低いスキャン文書に対して、認識精度を大幅に向上させることができます。
どの入力フォーマットを使用すべきですか?

using IronOcr;
using System;
// Instantiate OCR engine
var ocr = new IronTesseract();
// Load handwriting image
var inputHandWriting = new OcrInput();
inputHandWriting.LoadImage("handwritten.png");
// Perform OCR on the handwriting image
OcrHandwritingResult result = ocr.ReadHandwriting(inputHandWriting);
// Output the recognized handwritten text
Console.WriteLine(result.Text);
// Output the confidence score of the OCR result
Console.WriteLine(result.Confidence);using IronOcr;
using System;
// Instantiate OCR engine
var ocr = new IronTesseract();
// Load handwriting image
var inputHandWriting = new OcrInput();
inputHandWriting.LoadImage("handwritten.png");
// Perform OCR on the handwriting image
OcrHandwritingResult result = ocr.ReadHandwriting(inputHandWriting);
// Output the recognized handwritten text
Console.WriteLine(result.Text);
// Output the confidence score of the OCR result
Console.WriteLine(result.Confidence);Imports IronOcr
Imports System
' Instantiate OCR engine
Dim ocr As New IronTesseract()
' Load handwriting image
Dim inputHandWriting As New OcrInput()
inputHandWriting.LoadImage("handwritten.png")
' Perform OCR on the handwriting image
Dim result As OcrHandwritingResult = ocr.ReadHandwriting(inputHandWriting)
' Output the recognized handwritten text
Console.WriteLine(result.Text)
' Output the confidence score of the OCR result
Console.WriteLine(result.Confidence)Imports IronOcr
Imports System
' Instantiate OCR engine
Dim ocr As New IronTesseract()
' Load handwriting image
Dim inputHandWriting As New OcrInput()
inputHandWriting.LoadImage("handwritten.png")
' Perform OCR on the handwriting image
Dim result As OcrHandwritingResult = ocr.ReadHandwriting(inputHandWriting)
' Output the recognized handwritten text
Console.WriteLine(result.Text)
' Output the confidence score of the OCR result
Console.WriteLine(result.Confidence)どのような結果が期待できますか?

サンプル実行では、ReadHandwritingメソッドが90.6%の信頼スコアを報告し、開幕フレーズ「私の名前はErin Fishです。」を含むほとんどのテキストを正しく識別しました。
この強力な結果は、IronOCRが困難な手書き文字にも対応できることを示しています。 このエンジンは、文字間隔や文字のつながりに苦労しながらも、核となるメッセージの抽出に成功しました。 これはIronOCRが複雑で非標準的なテキストを効果的に処理することを示しています。
OCRの初心者には、手書き認識に取り組む前に当社の簡単なOCRチュートリアルで基本を理解することをお勧めします。
非同期版を使用する方法は?
IronOCRは非同期バージョンReadHandwritingAsyncをサポートしています。 これは、処理前に入力画像を取得する必要がある非同期コードを扱う場合に役立ちます。 非同期サポートドキュメントは、非同期OCR操作の実装に関する包括的なガイダンスを提供します。
同じ入力を使って、asyncメソッドの使い方を説明します:
using IronOcr;
using System;
using System.Threading.Tasks;
public class read_handwritten_image_async
{
public async Task codeAsync()
{
// Instantiate OCR engine
var ocr = new IronTesseract();
// Load handwriting image
var inputHandWriting = new OcrInput();
inputHandWriting.LoadImage("handwritten.png");
// Perform OCR using the async method with 'await'.
OcrHandwritingResult result = await ocr.ReadHandwritingAsync(inputHandWriting);
// Output the recognized handwriting text
Console.WriteLine(result.Text);
// Output the confidence score of the OCR result
Console.WriteLine(result.Confidence);
}
}using IronOcr;
using System;
using System.Threading.Tasks;
public class read_handwritten_image_async
{
public async Task codeAsync()
{
// Instantiate OCR engine
var ocr = new IronTesseract();
// Load handwriting image
var inputHandWriting = new OcrInput();
inputHandWriting.LoadImage("handwritten.png");
// Perform OCR using the async method with 'await'.
OcrHandwritingResult result = await ocr.ReadHandwritingAsync(inputHandWriting);
// Output the recognized handwriting text
Console.WriteLine(result.Text);
// Output the confidence score of the OCR result
Console.WriteLine(result.Confidence);
}
}Imports IronOcr
Imports System
Public Class read_handwritten_image_async
Public Async Function codeAsync() As Task
' Instantiate OCR engine
Dim ocr = New IronTesseract()
' Load handwriting image
Dim inputHandWriting = New OcrInput()
inputHandWriting.LoadImage("handwritten.png")
' Perform OCR using the async method with 'await'.
Dim result As OcrHandwritingResult = Await ocr.ReadHandwritingAsync(inputHandWriting)
' Output the recognized handwriting text
Console.WriteLine(result.Text)
' Output the confidence score of the OCR result
Console.WriteLine(result.Confidence)
End Function
End ClassImports IronOcr
Imports System
Public Class read_handwritten_image_async
Public Async Function codeAsync() As Task
' Instantiate OCR engine
Dim ocr = New IronTesseract()
' Load handwriting image
Dim inputHandWriting = New OcrInput()
inputHandWriting.LoadImage("handwritten.png")
' Perform OCR using the async method with 'await'.
Dim result As OcrHandwritingResult = Await ocr.ReadHandwritingAsync(inputHandWriting)
' Output the recognized handwriting text
Console.WriteLine(result.Text)
' Output the confidence score of the OCR result
Console.WriteLine(result.Confidence)
End Function
End Class自動キャンセル前のミリ秒数を指定するためのオプションパラメータtimeoutMsを提供できます。 デフォルト値は-1で、時間制限がないことを意味します。操作は完了するまで実行されます。
高度な処理技術
複雑な手書き認識シナリオについては、以下の高度なテクニックをご検討ください:
地域特定OCR: 用紙や構造化されたドキュメントで作業する際には、地域別のOCRを使用して手書きテキストを含む特定のエリアに集中します。 このアプローチは、処理領域を限定することで精度を向上させます:
using IronOcr;
using IronSoftware.Drawing;
using System;
var ocrTesseract = new IronTesseract();
using var ocrInput = new OcrInput();
// Define a specific region for signature area
var signatureRegion = new Rectangle(x: 100, y: 500, width: 300, height: 100);
ocrInput.LoadImage("form-with-signature.png", signatureRegion);
var signatureResult = ocrTesseract.ReadHandwriting(ocrInput);
Console.WriteLine($"Signature text: {signatureResult.Text}");using IronOcr;
using IronSoftware.Drawing;
using System;
var ocrTesseract = new IronTesseract();
using var ocrInput = new OcrInput();
// Define a specific region for signature area
var signatureRegion = new Rectangle(x: 100, y: 500, width: 300, height: 100);
ocrInput.LoadImage("form-with-signature.png", signatureRegion);
var signatureResult = ocrTesseract.ReadHandwriting(ocrInput);
Console.WriteLine($"Signature text: {signatureResult.Text}");Imports IronOcr
Imports IronSoftware.Drawing
Imports System
Dim ocrTesseract = New IronTesseract()
Using ocrInput = New OcrInput()
' Define a specific region for signature area
Dim signatureRegion = New Rectangle(x:=100, y:=500, width:=300, height:=100)
ocrInput.LoadImage("form-with-signature.png", signatureRegion)
Dim signatureResult = ocrTesseract.ReadHandwriting(ocrInput)
Console.WriteLine($"Signature text: {signatureResult.Text}")
End UsingImports IronOcr
Imports IronSoftware.Drawing
Imports System
Dim ocrTesseract = New IronTesseract()
Using ocrInput = New OcrInput()
' Define a specific region for signature area
Dim signatureRegion = New Rectangle(x:=100, y:=500, width:=300, height:=100)
ocrInput.LoadImage("form-with-signature.png", signatureRegion)
Dim signatureResult = ocrTesseract.ReadHandwriting(ocrInput)
Console.WriteLine($"Signature text: {signatureResult.Text}")
End Using進捗追跡: 複数の手書きドキュメントをバッチ処理する場合、進捗追跡を実装してOCR操作を監視します。
ocrTesseract.OcrProgress += (sender, e) =>
{
Console.WriteLine($"Processing: {e.ProgressPercent}% complete");
};ocrTesseract.OcrProgress += (sender, e) =>
{
Console.WriteLine($"Processing: {e.ProgressPercent}% complete");
};ocrTesseract.OcrProgress += Sub(sender, e)
Console.WriteLine($"Processing: {e.ProgressPercent}% complete")
End SubocrTesseract.OcrProgress += Sub(sender, e)
Console.WriteLine($"Processing: {e.ProgressPercent}% complete")
End Subどのような課題に注意すべきですか?
IronOCRは全体的な構造とテキストを保持する高い信頼性を達成しましたが、OCRはまだ手書き文字に苦戦しており、局所的なエラーにつながっています。 よくある課題として、抽出されたアウトプットの検証が必要です:
不規則な間隔: 印刷テキストは文字間に均一な間隔があります。 手書きの場合、筆と筆の間隔や文字のつながりが大きく異なります。 これは、ununiformedが個々の文字(un unifoc med)として分割され、一つの単語としてではなくなると示される不正確な文字分割を引き起こします。
ストロークバリエーション: 各人の手書きは独特であり、個々は毎回同じ文字を異なる方法で書きます。文字の接続やパターンは大幅に異なります。 エンジンは、ストロークの傾き、筆圧、フォルムのばらつきが大きいため、パターンマッチングの信頼性が標準化されたフォントよりも低くなる。
あいまいな文字の形状: 手書きはしばしば簡略化されたり急いで書かれたりするため、あいまいな形状が生じます。急いで書かれたeはcに似てしまったり、連結されたlとiが誤認されることがあります。
品質と解像度の問題: スキャン品質が悪い、解像度が低い、またはインクが薄れていると、認識精度に大きく影響します。 このような問題に直面した場合は、当社の一般的なトラブルシューティングガイドを参照して解決策を見つけてください。
この方法を使用する場合は、出力が意図された入力と一致していることを確認し、間隔の狭い単語や形の悪い単語に特に注意してください。 ユースケースに特有の一般的な誤認識を処理するための後処理ロジックの実装を検討してください。
ReadHandwritingメソッドは精度が低くなる可能性があります。よくある質問
IronOCRのReadHandwritingメソッドとは何ですか?
IronOCRのReadHandwritingメソッドは、画像から手書きのテキストを確実にデジタル化するための特殊機能であり、不規則なスペースやストロークの変動などの課題があっても、明瞭な英語の手書きに対して強力な結果を提供します。
.NETアプリケーションで手書きOCRを実装するにはどうすればいいですか?
手書きOCRを実装するには、IronOCRをインストールし、IronTesseractインスタンスを作成して、LoadImage()を使用して手書きの画像をロードし、ReadHandwriting()メソッドを呼び出して抽出されたテキストにアクセスします。
IronOCRの手書き認識の典型的な利用法は何ですか?
IronOCRの手書き認識は、歴史的な文書のデジタル化、医療フォームの処理、手書きのノートを変換してデータの整合性を向上させ、手動処理エラーを減少させるために使用できます。
IronOCRは品質の悪いまたは低解像度の手書き画像を処理できますか?
はい、IronOCRは画像の品質補正フィルターを使用して、可読性を高め、認識精度を向上させることで、品質の悪いまたは低解像度の画像をよりよく処理できます。
IronOCRは手書きの複数言語の認識をサポートしていますか?
現在、ReadHandwritingメソッドは手書きにおいて英語のみをサポートしています。複数言語でOCRを行うには、適切な言語パックを使用して標準のRead()メソッドを使用する必要があります。
IronOCRの手書き認識の精度はどれくらいですか?
IronOCRのReadHandwritingメソッドは、英語の難しい手書きスクリプトを認識する際に約90.6%の信頼度を報告するほどテストされています。これには、スペースや連結文字の複雑さを克服する事が含まれます。
手書き認識にIronOCRを非同期で使用するにはどうすればいいですか?
IronOCRを使用すると、ReadHandwritingAsyncメソッドを使用して非同期でOCRを行うことができます。これは非同期処理を必要とするシナリオで役立ち、C#のasync/awaitパターンを用いて操作を処理することができます。
IronOCRを使用した手書きOCRのための高度な技術は何ですか?
高度な技術には、手書きのテキストがある箇所に処理を集中させるためのフォームや特定の文書に対する領域特定OCRや、バッチ処理の進捗追跡の実装が含まれます。
手書き認識においてOCRが直面する一般的な課題は何ですか?
IronOCRは、不規則なスペース、ストロークの変動、曖昧な文字形、高品質でないスキャンなどの課題に直面し、それがOCR結果に影響を及ぼす可能性があり、抽出されたテキストの確認を必要とします。
IronOCRは手書きにおけるOCRの課題にどのように対処していますか?
IronOCRは、画像処理の進化を機械学習技術と組み合わせることで、画像から手書きのテキストを認識しデジタル化する際の信頼性を高めることで、OCRの課題に対処します。
Curtis Chauは、カールトン大学でコンピュータサイエンスの学士号を取得し、Node.js、TypeScript、JavaScript、およびReactに精通したフロントエンド開発を専門としています。直感的で美しいユーザーインターフェースを作成することに情熱を持ち、Curtisは現代のフレームワークを用いた開発や、構造の良い視覚的に魅力的なマニュアルの作成を楽しんでいます。