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

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

  • タイ語
  • タイベスト
  • タイファースト
  • タイ語アルファベット
  • タイ語アルファベットベスト
  • タイ語アルファベット高速

ダウンロード

タイ語アルファベット言語パック[タイ語]

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

インストール

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

Install-Package IronOCR.Languages.Thai

Code Example

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

// Ensure you have installed the IronOCR.Languages.Thai package via NuGet.
// Import the IronOcr namespace to work with IronOCR classes.
using IronOcr; 

class ThaiOcrExample
{
    static void Main()
    {
        // Create a new instance of IronTesseract for OCR processing
        var ocr = new IronTesseract();

        // Set the language to Thai for Optical Character Recognition
        ocr.Language = OcrLanguage.Thai;

        // Using the 'using' statement ensures that resources are properly disposed.
        using (var input = new OcrInput(@"images\Thai.png"))
        {
            // Perform OCR to read the text from the input image
            var result = ocr.Read(input);

            // Retrieve and store all recognized text from the image
            string allText = result.Text;

            // Optionally, you can output the text to console or log it as needed
            System.Console.WriteLine(allText);
        }
    }
}
// Ensure you have installed the IronOCR.Languages.Thai package via NuGet.
// Import the IronOcr namespace to work with IronOCR classes.
using IronOcr; 

class ThaiOcrExample
{
    static void Main()
    {
        // Create a new instance of IronTesseract for OCR processing
        var ocr = new IronTesseract();

        // Set the language to Thai for Optical Character Recognition
        ocr.Language = OcrLanguage.Thai;

        // Using the 'using' statement ensures that resources are properly disposed.
        using (var input = new OcrInput(@"images\Thai.png"))
        {
            // Perform OCR to read the text from the input image
            var result = ocr.Read(input);

            // Retrieve and store all recognized text from the image
            string allText = result.Text;

            // Optionally, you can output the text to console or log it as needed
            System.Console.WriteLine(allText);
        }
    }
}
' Ensure you have installed the IronOCR.Languages.Thai package via NuGet.
' Import the IronOcr namespace to work with IronOCR classes.
Imports IronOcr

Friend Class ThaiOcrExample
	Shared Sub Main()
		' Create a new instance of IronTesseract for OCR processing
		Dim ocr = New IronTesseract()

		' Set the language to Thai for Optical Character Recognition
		ocr.Language = OcrLanguage.Thai

		' Using the 'using' statement ensures that resources are properly disposed.
		Using input = New OcrInput("images\Thai.png")
			' Perform OCR to read the text from the input image
			Dim result = ocr.Read(input)

			' Retrieve and store all recognized text from the image
			Dim allText As String = result.Text

			' Optionally, you can output the text to console or log it as needed
			System.Console.WriteLine(allText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel

この例では、 imagesフォルダにあるThai.pngという名前の画像からタイ語のテキストを読み取ります。 ファイル パスを実際の画像の場所に置き換えてください。 OCR 言語は OcrLanguage.Thai を使用してタイ語の認識用の言語パッケージを指定して設定します。