Tigrinya 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的內容。語言。提格雷尼亞語

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

提格里尼亞語 提格里尼亞語Best 提格里尼亞語Fast

下載

提格里尼亞語語言包[ትግርኛ]

下載為Zip 檔案

安裝

我們首先需要做的是將Tigrinya OCR 套件安裝到您的.NET專案中。

Install-Package IronOcr.Languages.Tigrinya

程式碼範例

這段 C# 程式碼範例從圖像或 PDF 文件中讀取提格雷尼亞語文字。

using IronOcr;

class Program
{
    static void Main()
    {
        // Create a new instance of IronTesseract to perform OCR
        var Ocr = new IronTesseract();

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

        // Using statement ensures the OcrInput object is disposed of after use
        using (var Input = new OcrInput(@"images\Tigrinya.png"))
        {
            // Perform OCR on the input image
            var Result = Ocr.Read(Input);

            // Extract all text recognized in the image and store it in a variable
            var AllText = Result.Text;

            // Output the extracted text
            Console.WriteLine(AllText);
        }
    }
}
using IronOcr;

class Program
{
    static void Main()
    {
        // Create a new instance of IronTesseract to perform OCR
        var Ocr = new IronTesseract();

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

        // Using statement ensures the OcrInput object is disposed of after use
        using (var Input = new OcrInput(@"images\Tigrinya.png"))
        {
            // Perform OCR on the input image
            var Result = Ocr.Read(Input);

            // Extract all text recognized in the image and store it in a variable
            var AllText = Result.Text;

            // Output the extracted text
            Console.WriteLine(AllText);
        }
    }
}
$vbLabelText   $csharpLabel

解釋

  • IronTesseract :這是IronOCR中的一個專門用於執行文字辨識的類別。
  • Ocr.Language :設定 OCR 引擎所使用的語言。在本例中,它設定為提格雷尼亞語。
  • OcrInput :表示輸入來源,在本例中為影像,將轉換為文字。
  • Ocr.Read(Input) : 對指定的輸入執行 OCR 並傳回結果。
  • Result.Text :包含從輸入影像經過 OCR 處理後擷取的文字。
  • Console.WriteLine(AllText) : 將擷取的文字輸出到控制台。 這行程式碼是可選的,如果不需要控制台輸出,可以刪除。