Irish 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.Irish 的內容

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

  • 愛爾蘭語
  • 愛爾蘭語Best
  • 愛爾蘭語Fast

下載

愛爾蘭語語言包 [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);
        }
    }
}
Imports IronOcr

Module IrishOcrExample

    Sub Main()
        ' Create a new instance of the IronTesseract OCR engine
        Dim Ocr As 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 As 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 As String = Result.Text

            ' Output the recognized text
            Console.WriteLine(AllText)
        End Using
    End Sub

End Module
$vbLabelText   $csharpLabel

在此範例中,我們使用 IronOCR程式庫中的 IronTesseract 類別,對一張包含愛爾蘭語文字的圖片進行 OCR 處理。 OcrInput 物件用於載入圖片,而 Ocr.Read 方法則用於處理圖片以擷取文字。 生成的文字隨後儲存於 AllText 變數中,並 PRINT 至控制台。