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 程式設計師能夠從 126 種語言(包括提格雷尼亞語)的圖片和 PDF 文件中讀取文字。 這是 Tesseract 的進階分支版本,專為 .NET 開發人員打造,無論在速度或準確度方面,其表現均定期超越其他 Tesseract 引擎。

IronOcr.Languages.Tigrinya 的內容

此套件包含 49 種適用於 .NET 的 OCR 語言:

  • 提格雷尼亞語
  • 提格雷尼亞語Best
  • 提格雷尼亞語Fast

下載

提格雷尼亞語語言套件 [ትግርኛ]

安裝

我們首先必須將提格雷尼亞語 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);
        }
    }
}
Imports IronOcr

Friend Class Program
	Shared Sub Main()
		' Create a new instance of IronTesseract to perform OCR
		Dim 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 Input = New OcrInput("images\Tigrinya.png")
			' Perform OCR on the input image
			Dim Result = Ocr.Read(Input)

			' Extract all text recognized in the image and store it in a variable
			Dim AllText = Result.Text

			' Output the extracted text
			Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel

說明

  • IronTesseract:這是 IronOCR 中的專用類別,用於執行文字辨識。
  • Ocr.Language:設定 OCR 引擎使用的語言。在此範例中,設定為提格雷尼亞語。
  • OcrInput:代表輸入來源(此處為影像),該資料將被轉換為文字。
  • Ocr.Read(Input):對指定的輸入執行 OCR 並返回結果。
  • Result.Text:包含 OCR 處理後從輸入圖片中擷取的文字。
  • Console.WriteLine(AllText):將擷取的文字輸出至控制台。 此行為可選內容,若無需控制台輸出,可予以刪除。