Yoruba OCR in C# and .NET
Curtis Chau
已更新: 2026年8月2日
本文檔的其他版本:
IronOCR 是一個 C# 軟體元件,它允許 .NET 開發人員從圖像和 PDF 文件中讀取 126 種語言(包括約魯巴語)的文字。 它是 Tesseract 的一個高級分支,專為 .NET 開發人員構建,在速度和準確性方面通常優於其他 Tesseract 引擎。
IronOcr.Languages.Yoruba 的內容
此軟體包包含 43 種適用於 .NET 的 OCR 語言:
- 約魯巴語
- 約魯巴語最佳
- 約魯巴語快速
下載
約魯巴語語言包[約魯巴語]
安裝
首要任務是將Yoruba OCR 套件安裝到您的 .NET 專案中。
程式碼範例
這段 C# 程式碼範例從圖像或 PDF 文件中讀取約魯巴語文字。
// Remember to install the package first:
// PM> Install-Package IronOcr.Languages.Yoruba
using IronOcr;
class Program
{
static void Main()
{
// Create a new instance of the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Set the OCR language to Yoruba
Ocr.Language = OcrLanguage.Yoruba;
// Specify the image or PDF file to read
using (var Input = new OcrInput(@"images\Yoruba.png"))
{
// Perform OCR on the input file
var Result = Ocr.Read(Input);
// Extract all recognized text
var AllText = Result.Text;
// Output the recognized text
Console.WriteLine("Recognized Text: ");
Console.WriteLine(AllText);
}
}
}' Remember to install the package first:
' PM> Install-Package IronOcr.Languages.Yoruba
Imports IronOcr
Module Program
Sub Main()
' Create a new instance of the IronTesseract OCR engine
Dim Ocr As New IronTesseract()
' Set the OCR language to Yoruba
Ocr.Language = OcrLanguage.Yoruba
' Specify the image or PDF file to read
Using Input As New OcrInput("images\Yoruba.png")
' Perform OCR on the input file
Dim Result = Ocr.Read(Input)
' Extract all recognized text
Dim AllText = Result.Text
' Output the recognized text
Console.WriteLine("Recognized Text: ")
Console.WriteLine(AllText)
End Using
End Sub
End Module' Remember to install the package first:
' PM> Install-Package IronOcr.Languages.Yoruba
Imports IronOcr
Module Program
Sub Main()
' Create a new instance of the IronTesseract OCR engine
Dim Ocr As New IronTesseract()
' Set the OCR language to Yoruba
Ocr.Language = OcrLanguage.Yoruba
' Specify the image or PDF file to read
Using Input As New OcrInput("images\Yoruba.png")
' Perform OCR on the input file
Dim Result = Ocr.Read(Input)
' Extract all recognized text
Dim AllText = Result.Text
' Output the recognized text
Console.WriteLine("Recognized Text: ")
Console.WriteLine(AllText)
End Using
End Sub
End Module程式碼中的註釋解釋了每個步驟,從設定語言到提取和列印識別出的文字。 本範例重點介紹如何使用 IronOCR 讀取約魯巴文字,方法是指定約魯巴語並處理圖像或 PDF 文件。
Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。