Tigrinya OCR in C# and .NET
Curtis Chau
已更新: 2026年8月2日
IronOCR 是一個 C# 軟體元件,允許 .NET 程式設計師從圖像和 PDF 文件中讀取 126 種語言的文字,包括提格雷語。 它是 Tesseract 的一個高級分支,專為 .NET 開發人員構建,在速度和準確性方面通常優於其他 Tesseract 引擎。
IronOcr.Languages.Tigrinya 的內容
此軟體包包含 49 種適用於 .NET 的 OCR 語言:
- Tigrinya
- TigrinyaBest
- TigrinyaFast
下載
提格里尼亞語語言包[提格里尼亞語]
安裝
我們首先需要做的是將Tigrinya OCR 套件安裝到您的 .NET 專案中。
程式碼範例
這段 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);
}
}
}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 ClassImports 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說明
- IronTesseract: 這是來自IronOCR的一個專門類別,用於執行文字識別。
- Ocr.Language: 設定OCR引擎使用的語言。在此例中,設為Tigrinya。
- OcrInput: 表示輸入來源,此例中為一張影像,將轉換為文字。
Ocr.Read(Input): 對指定輸入執行OCR並返回結果。- Result.Text: 包含OCR過程後從輸入影像中提取的文字。
Console.WriteLine(AllText): 將提取的文字輸出到控制台。 這行程式碼是可選的,如果不需要控制台輸出,可以刪除。
Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。