C# と .NET での Han Simplified Alphabet OCR
IronOCR は、.NET コーダーが簡体字漢字を含む 126 の言語で画像や PDF ドキュメントからテキストを読み取ることができる C# ソフトウェア コンポーネントです。
これはTesseractの高度なフォークであり、.NET開発者専用に構築され、速度と精度の両方で他のTesseractエンジンを定期的に上回ります。
IronOcr.Languages.Han の内容
このパッケージには、.NET 用の 400 の OCR 言語が含まれています。
- 簡体字アルファベット
- 簡体字アルファベットベスト
- 簡体字アルファベット高速
- 簡体字縦書きアルファベット
- 簡体字漢字垂直アルファベットベスト
- 簡体字漢字垂直アルファベットファスト
- 繁体字漢字アルファベット
- 繁体字漢字アルファベットベスト
- 繁体字漢字アルファベットファスト
- 繁体字漢字垂直アルファベット
- 漢数字 縦書き アルファベット ベスト
- ハングル 繁体字 縦書き アルファベット 高速
ダウンロード
簡体字漢字言語パック [Samhan]
インストール
最初に、Han Simplified Alphabet OCR パッケージを .NET プロジェクトにインストールする必要があります。
パッケージ マネージャー コンソールで次のコマンドを実行します。
Install-Package IronOCR.Languages.Han
Code Example
この C# コード例は、画像または PDF ドキュメントから Han Simplified Alphabet のテキストを読み取ります。
// Reference the IronOcr library
using IronOcr;
class Program
{
static void Main()
{
// Create an IronTesseract OCR engine
var Ocr = new IronTesseract();
// Load the Han language for OCR processing
Ocr.Language = OcrLanguage.Han;
// Using a 'using' statement for resource management
using (var Input = new OcrInput(@"images\Han.png"))
{
// Process the image to extract text
var Result = Ocr.Read(Input);
// Retrieve and display the extracted text
string AllText = Result.Text;
System.Console.WriteLine(AllText);
}
}
}// Reference the IronOcr library
using IronOcr;
class Program
{
static void Main()
{
// Create an IronTesseract OCR engine
var Ocr = new IronTesseract();
// Load the Han language for OCR processing
Ocr.Language = OcrLanguage.Han;
// Using a 'using' statement for resource management
using (var Input = new OcrInput(@"images\Han.png"))
{
// Process the image to extract text
var Result = Ocr.Read(Input);
// Retrieve and display the extracted text
string AllText = Result.Text;
System.Console.WriteLine(AllText);
}
}
}' Reference the IronOcr library
Imports IronOcr
Friend Class Program
Shared Sub Main()
' Create an IronTesseract OCR engine
Dim Ocr = New IronTesseract()
' Load the Han language for OCR processing
Ocr.Language = OcrLanguage.Han
' Using a 'using' statement for resource management
Using Input = New OcrInput("images\Han.png")
' Process the image to extract text
Dim Result = Ocr.Read(Input)
' Retrieve and display the extracted text
Dim AllText As String = Result.Text
System.Console.WriteLine(AllText)
End Using
End Sub
End Class説明
- まず、IronOcr ライブラリを参照して、OCR 機能を使用します。
- 画像/PDF ドキュメントを処理するために
IronTesseractのインスタンスが作成されます。 - OCR プロセスの言語は、
Ocr.Languageを使用してHanに設定されます。 - 画像は
OcrInputを使用して読み込まれ、Ocr.Read()を呼び出して処理されます。 - OCR プロセスの結果は
Result.Textに保存され、ドキュメントから抽出されたテキストが含まれます。 - 最後に、テキストをコンソールに出力します。
適切な using ディレクティブを持ち、特にファイルストリームのような未管理リソースを扱う際に、using ステートメントでリソースを効率的に管理することを確認してください。





