Bengali OCR in C# and .NET

This article was translated from English: Does it need improvement?
Translated
View the article in English
このドキュメントの他のバージョン:

*ベンガル語

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 言語をベンガル語に設定します。

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

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

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