泰語字母OCR在C#和.NET中

Curtis Chau
Curtis Chau
已更新: 2026年8月2日
本文檔的其他版本:

IronOCR 是一個 C# 軟體元件,允許 .NET 程式設計師從圖像和 PDF 文件中讀取 126 種語言的文字,包括泰語字母。

它是 Tesseract 的一個高級分支,專為 .NET 開發人員構建,在速度和準確性方面通常優於其他 Tesseract 引擎。

IronOcr.Languages.Thai 的內容

此軟體包包含 96 種適用於 .NET 的 OCR 語言:

  • 泰語
  • 泰語最佳
  • 泰語快速
  • 泰語字母
  • 泰語字母最佳
  • 泰語字母快速

下載

泰語字母語言包[ไทย]

安裝

我們首先需要做的就是將我們的泰文字母OCR 套件安裝到您的 .NET 專案中。

PM > Install-Package IronOcr.Languages.Thai

程式碼範例

這段 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);
        }
    }
}

在此範例中,我們從位於 images 資料夾中的圖像 Thai.png 讀取泰文字。 請務必將檔案路徑替換為您實際的圖片位置。 使用 OcrLanguage.Thai 設定OCR語言為泰語,以指定泰語識別套件。

Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。

閱讀更多

準備好開始了嗎?

NuGet 下載次數 6,411,693版本:2026.11剛剛發布