Latvian 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.Latvian の内容

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

  • ラトビア語
  • ラトビア語Best
  • ラトビアファースト

ダウンロード

ラトビア語言語パック[ラトビア語]

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

インストール

最初に行う必要があるのは、ラトビア語OCR パッケージを .NET プロジェクトにインストールすることです。

Install-Package IronOcr.Languages.Latvian

Code Example

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

using IronOcr;

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

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

        // Define the input image file path
        using (var Input = new OcrInput(@"images\Latvian.png"))
        {
            // Perform OCR on the input image
            var Result = Ocr.Read(Input);

            // Extract all recognized text from the OCR result
            var AllText = Result.Text;

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

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

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

        // Define the input image file path
        using (var Input = new OcrInput(@"images\Latvian.png"))
        {
            // Perform OCR on the input image
            var Result = Ocr.Read(Input);

            // Extract all recognized text from the OCR result
            var AllText = Result.Text;

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

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

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

		' Define the input image file path
		Using Input = New OcrInput("images\Latvian.png")
			' Perform OCR on the input image
			Dim Result = Ocr.Read(Input)

			' Extract all recognized text from the OCR result
			Dim AllText = Result.Text

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

説明

  • IronOCR 名前空間: この例はOCR機能にアクセスするために必要なIronOcr名前空間をインポートすることから始まります。
  • IronTesseract インスタンス: 画像を読み込みテキストを抽出するためにOcr)が作成されます。
  • 言語設定: OCRプロセスはOcr.Languageプロパティを設定してラトビア語のテキストを読むように構成されています。
  • OcrInput オブジェクト: 処理する画像ファイルを参照するOcrInputオブジェクトが作成されます。
  • 画像の読み込み: 画像を処理しテキストを抽出するために、Result変数に格納されます。
  • 結果の抽出: OCRの結果はAllTextに保管されます。 -コンソール出力:認識されたラトビア語のテキストがコンソールに出力され、テキスト抽出を視覚的に確認できます。