Irish OCR in C# and .NET

This article was translated from English: Does it need improvement?
Translated
View the article in English
Other versions of this document:

IronOCR 是一個 C# 軟體組件,允許 .NET 程式員從包括愛爾蘭語在內的 126 種語言的圖片和 PDF 文件中讀取文字。

它是一個專為 .NET 開發者設計的 Tesseract 高級分支,在速度和準確性方面經常優於其他 Tesseract 引擎。

IronOcr.Languages.Irish 的內容

此包包含 40 種 .NET 的 OCR 語言:

  • 愛爾蘭語
  • 愛爾蘭語最佳
  • 愛爾蘭語快速

下載

愛爾蘭語語言包 style='white-space:default'>[Gaeilge]

安裝

首先,我們必須將愛爾蘭語 OCR 套件安裝到您的 .NET 專案中。

Install-Package IronOCR.Languages.Irish

代碼示例

這個 C# 代碼範例從圖片或 PDF 文件中讀取愛爾蘭語文字。

// Install the IronOCR Irish language package via NuGet:
// PM> Install-Package IronOCR.Languages.Irish

using IronOcr;

class IrishOcrExample
{
    static void Main()
    {
        // Create a new instance of the IronTesseract OCR engine
        var Ocr = new IronTesseract();

        // Set the language to Irish for OCR processing
        Ocr.Language = OcrLanguage.Irish;

        // Using the OCR input, specify the path to the image containing Irish text
        using (var Input = new OcrInput(@"images\Irish.png"))
        {
            // Perform OCR to read the Irish text from the image
            var Result = Ocr.Read(Input);

            // Get the recognized text as a string from the OCR result
            var AllText = Result.Text;

            // Output the recognized text
            Console.WriteLine(AllText);
        }
    }
}
// Install the IronOCR Irish language package via NuGet:
// PM> Install-Package IronOCR.Languages.Irish

using IronOcr;

class IrishOcrExample
{
    static void Main()
    {
        // Create a new instance of the IronTesseract OCR engine
        var Ocr = new IronTesseract();

        // Set the language to Irish for OCR processing
        Ocr.Language = OcrLanguage.Irish;

        // Using the OCR input, specify the path to the image containing Irish text
        using (var Input = new OcrInput(@"images\Irish.png"))
        {
            // Perform OCR to read the Irish text from the image
            var Result = Ocr.Read(Input);

            // Get the recognized text as a string from the OCR result
            var AllText = Result.Text;

            // Output the recognized text
            Console.WriteLine(AllText);
        }
    }
}
' Install the IronOCR Irish language package via NuGet:
' PM> Install-Package IronOCR.Languages.Irish

Imports IronOcr

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

		' Set the language to Irish for OCR processing
		Ocr.Language = OcrLanguage.Irish

		' Using the OCR input, specify the path to the image containing Irish text
		Using Input = New OcrInput("images\Irish.png")
			' Perform OCR to read the Irish text from the image
			Dim Result = Ocr.Read(Input)

			' Get the recognized text as a string from the OCR result
			Dim AllText = Result.Text

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

在這個範例中,我們利用 IronOCR 函式庫中的 IronTesseract 類對包含愛爾蘭語文字的圖片進行 OCR。 OcrInput 物件用於載入圖片,Ocr.Read 方法處理圖片以提取文字。 結果文字然後存儲在 AllText 變量中並打印到控制台。