Tonga OCR in C# and .NET

This article was translated from English: Does it need improvement?
Translated
View the article in English

還有126種語言

IronOCR是一個 C# 軟體元件,它允許.NET開發人員從圖像和 PDF 文件中讀取 126 種語言(包括湯加語)的文字。 它是 Tesseract 的一個高級分支,專為.NET開發人員量身定制,在速度和準確性方面通常優於其他 Tesseract 引擎。

IronOCR的內容。語言。東加語

此軟體包包含三個專門用於湯加語的OCR語言模型:

  • 東加
  • 東加Best
  • 東加Fast

下載

湯加語言包[faka Tonga]

  • 下載為Zip檔。
  • 使用NuGet安裝。

安裝

若要開始使用Tonga OCR 功能,請使用下列NuGet指令將 Tonga OCR 套件安裝到您的.NET專案中:

Install-Package IronOcr.Languages.Tonga

程式碼範例

以下 C# 程式碼範例示範如何使用IronOCR從圖像或 PDF 文件中讀取湯加語文字。

// Include the necessary IronOcr namespace
using IronOcr;

class TongaOcrExample
{
    static void Main()
    {
        // Initialize the IronTesseract OCR engine
        var Ocr = new IronTesseract();

        // Set the OCR engine to use the Tonga language pack
        Ocr.Language = OcrLanguage.Tonga;

        // Load the input image or PDF into OcrInput
        using (var Input = new OcrInput(@"images\Tonga.png"))
        {
            // Perform OCR to read the text from the image
            var Result = Ocr.Read(Input);

            // Retrieve the full text recognition result
            var AllText = Result.Text;

            // Output the result or process further as needed
            System.Console.WriteLine(AllText);
        }
    }
}
// Include the necessary IronOcr namespace
using IronOcr;

class TongaOcrExample
{
    static void Main()
    {
        // Initialize the IronTesseract OCR engine
        var Ocr = new IronTesseract();

        // Set the OCR engine to use the Tonga language pack
        Ocr.Language = OcrLanguage.Tonga;

        // Load the input image or PDF into OcrInput
        using (var Input = new OcrInput(@"images\Tonga.png"))
        {
            // Perform OCR to read the text from the image
            var Result = Ocr.Read(Input);

            // Retrieve the full text recognition result
            var AllText = Result.Text;

            // Output the result or process further as needed
            System.Console.WriteLine(AllText);
        }
    }
}
$vbLabelText   $csharpLabel
  • 此程式碼範例示範如何初始化 IronTesseract OCR 引擎並將其設定為使用湯加語。
  • 我們將指定路徑中的映像載入到 OcrInput 物件中。
  • Ocr.Read() 方法處理輸入以提取文本,然後我們透過 Result.Text 屬性檢索識別的文本。 最後,提取的文字可以根據需要在應用程式中輸出或處理。