C# と .NET でのベンガル語 OCR

This article was translated from English: Does it need improvement?
Translated
View the article in English
Other versions of this document:

*ベンガル語

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

IronOcr.Languages.Bengali の内容

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

  • ベンガル語
  • ベンガル語ベスト
  • ベンガルファースト
  • ベンガルアルファベット
  • ベンガル語アルファベットベスト
  • ベンガル語アルファベット高速

ダウンロード

ベンガル語言語パック[ベンガル語]

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

インストール

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

Install-Package IronOCR.Languages.Bengali

Code Example

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

// Import the IronOcr namespace
using IronOcr;

class BengaliOcrExample
{
    static void Main()
    {
        // Create an instance of IronTesseract
        var Ocr = new IronTesseract();

        // Specify the language for OCR
        Ocr.Language = OcrLanguage.Bengali;

        // Process the image and extract text
        using (var Input = new OcrInput(@"images\Bengali.png"))
        {
            // Perform OCR on the input image
            var Result = Ocr.Read(Input);

            // Get the extracted text
            var AllText = Result.Text;

            // Output the extracted text to the console
            System.Console.WriteLine(AllText);
        }
    }
}
// Import the IronOcr namespace
using IronOcr;

class BengaliOcrExample
{
    static void Main()
    {
        // Create an instance of IronTesseract
        var Ocr = new IronTesseract();

        // Specify the language for OCR
        Ocr.Language = OcrLanguage.Bengali;

        // Process the image and extract text
        using (var Input = new OcrInput(@"images\Bengali.png"))
        {
            // Perform OCR on the input image
            var Result = Ocr.Read(Input);

            // Get the extracted text
            var AllText = Result.Text;

            // Output the extracted text to the console
            System.Console.WriteLine(AllText);
        }
    }
}
' Import the IronOcr namespace
Imports IronOcr

Friend Class BengaliOcrExample
	Shared Sub Main()
		' Create an instance of IronTesseract
		Dim Ocr = New IronTesseract()

		' Specify the language for OCR
		Ocr.Language = OcrLanguage.Bengali

		' Process the image and extract text
		Using Input = New OcrInput("images\Bengali.png")
			' Perform OCR on the input image
			Dim Result = Ocr.Read(Input)

			' Get the extracted text
			Dim AllText = Result.Text

			' Output the extracted text to the console
			System.Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel

説明

  1. IronOcr のインポート:まず、OCR 操作を実行するために必要なクラスとメソッドが含まれるIronOcr名前空間をインポートします。

  2. IronTesseract インスタンスを作成する: OCR を実行するためのメインクラスであるIronTesseractのインスタンスを作成します。

  3. 言語を設定: OcrLanguage.Bengaliを使用してOCR言語をベンガル語に設定します。

  4. OcrInput:テキストを抽出する画像へのパスを指定します。 OcrInputオブジェクトは、入力ファイルの読み込みと前処理に使用されます。

5.テキストの読み取りと抽出: Readメソッドを使用して、画像を処理してテキスト コンテンツを読み取ります。 テキストはResult.Textに保存されます。

6.出力テキスト:最後に、抽出したテキストをコンソールに出力して出力を確認します。