C# と .NET でのスワヒリ語 OCR

This article was translated from English: Does it need improvement?
Translated
View the article in English

この文書の他のバージョン

*スワヒリ語

IronOCR は、.NET コーダーがスワヒリ語を含む 126 の言語で画像や PDF ドキュメントからテキストを読み取ることを可能にする C# ソフトウェア コンポーネントです。 これは、.NET 開発者専用に構築された Tesseract の高度なフォークであり、速度と精度の両方において他の Tesseract エンジンを常に上回っています。

IronOcr.Languages.Swahili の内容

このパッケージには、.NET 用の 46 の OCR 言語が含まれています。

  • スワヒリ語
  • スワヒリ語ベスト
  • スワヒリファスト

ダウンロード

スワヒリ語言語パック [スワヒリ語]

  • Zip形式でダウンロード
  • NuGetでインストール

インストール

最初に、スワヒリ語OCR パッケージを .NET プロジェクトにインストールする必要があります。

Install-Package IronOCR.Languages.Swahili

Code Example

この C# コード例は、画像または PDF ドキュメントからスワヒリ語のテキストを読み取ります。

using IronOcr;

var Ocr = new IronTesseract();

// Set the OCR language to Swahili
Ocr.Language = OcrLanguage.Swahili;

// Create an OCR input for the image or PDF file
using (var Input = new OcrInput(@"images\Swahili.png"))
{
    // Perform OCR on the input image
    var Result = Ocr.Read(Input);

    // Retrieve the recognized text
    var AllText = Result.Text;

    // Output the recognized text to the console (optional)
    Console.WriteLine(AllText);
}
using IronOcr;

var Ocr = new IronTesseract();

// Set the OCR language to Swahili
Ocr.Language = OcrLanguage.Swahili;

// Create an OCR input for the image or PDF file
using (var Input = new OcrInput(@"images\Swahili.png"))
{
    // Perform OCR on the input image
    var Result = Ocr.Read(Input);

    // Retrieve the recognized text
    var AllText = Result.Text;

    // Output the recognized text to the console (optional)
    Console.WriteLine(AllText);
}
Imports IronOcr

Private Ocr = New IronTesseract()

' Set the OCR language to Swahili
Ocr.Language = OcrLanguage.Swahili

' Create an OCR input for the image or PDF file
Using Input = New OcrInput("images\Swahili.png")
	' Perform OCR on the input image
	Dim Result = Ocr.Read(Input)

	' Retrieve the recognized text
	Dim AllText = Result.Text

	' Output the recognized text to the console (optional)
	Console.WriteLine(AllText)
End Using
$vbLabelText   $csharpLabel

説明:

  1. IronOcr 名前空間の使用: OCR 操作用のクラスとメソッドを提供するIronOcr名前空間をインクルードします。

  2. OCRエンジンの初期化:OCRエンジンであるIronTesseractのインスタンスを作成します。言語をスワヒリ語に設定することで、スワヒリ語のテキストを認識できるようになります。

  3. OCR 入力: OcrInputクラスは、テキストを抽出するファイル (画像または PDF) を指定するために使用されます。

  4. OCR 読み取り: Readメソッドは入力を処理し、認識されたテキストを含むOcrResultオブジェクトを返します。

5.出力: 認識されたテキストはAllTextに保存され、必要に応じて使用できます。 この例では、デモンストレーションの目的でコンソールに出力されます。