Yoruba OCR in C# and .NET

This article was translated from English: Does it need improvement?
Translated
View the article in English
本文件的其他版本:

IronOCR 是一個 C# 軟體元件,讓 .NET 開發人員能夠從 126 種語言(包括約魯巴語)的圖片和 PDF 文件中讀取文字。 這是 Tesseract 的進階分支版本,專為 .NET 開發人員打造,無論在速度或準確度方面,其表現通常都優於其他 Tesseract 引擎。

IronOcr.Languages.Yoruba 的內容

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

  • 約魯巴語
  • 約魯巴語Best
  • 約魯巴語Fast

下載

約魯巴語語言套件 [Yorùbá]

安裝

首要任務是將 Yoruba OCR 套件安裝至您的 .NET 專案中。

Install-Package IronOcr.Languages.Yoruba

程式碼範例

此 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

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

Friend Class Program
	Shared Sub Main()
		' Create a new instance of the IronTesseract OCR engine
		Dim Ocr = New IronTesseract()

		' Set the OCR language to Yoruba
		Ocr.Language = OcrLanguage.Yoruba

		' Specify the image or PDF file to read
		Using Input = 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 Class
$vbLabelText   $csharpLabel

程式碼中的註解說明了每個步驟,從設定語言到擷取並列印已識別的文字。 此範例著重於透過 IronOCR 讀取約魯巴語文字,方法是指定約魯巴語並處理圖片或 PDF 檔案。