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 Instance: 画像の読み取りとテキスト抽出を処理するために、Ocr)が作成されます。
  • 言語設定: Ocr.Language プロパティを設定することで、OCR処理がラトビア語のテキストを読み取るように構成されています。
  • OcrInput オブジェクト: 処理対象の画像ファイルを参照する OcrInput オブジェクトが作成されます。
  • 画像の読み取り:Result変数に格納されます。
  • 結果の抽出: OCRの結果は Result.Text 経由でアクセスされ、後続の処理や表示のために AllText に保存されます。 -コンソール出力:認識されたラトビア語のテキストがコンソールに出力され、テキスト抽出を視覚的に確認できます。