Irish OCR in C# and .NET

This article was translated from English: Does it need improvement?
Translated
View the article in English
Inne wersje tego dokumentu:

IronOCR to komponent oprogramowania C#, który pozwala programistom .NET odczytywać tekst z obrazów i dokumentów PDF w 126 językach, w tym po irlandzku.

Jest to zaawansowany fork Tesseracta, zbudowany wyłącznie dla deweloperów .NET i regularnie przewyższający inne silniki Tesseract pod względem szybkości i dokładności.

Zawartość IronOcr.Languages.Irish

Ten pakiet zawiera 40 języków OCR dla .NET:

  • Irish
  • IrishBest
  • IrishFast

Pobieranie

Irish Language Pack [Gaeilge]

Instalacja

Pierwszą rzeczą, którą musimy zrobić, jest zainstalowanie naszego pakietu OCR Irish do projektu .NET.

Install-Package IronOcr.Languages.Irish

Przyklad kodu

Ten przykład kodu C# odczytuje tekst irlandzki z obrazu lub dokumentu 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

W tym przykładzie używamy klasy IronTesseract z biblioteki IronOCR do wykonania OCR na obrazie zawierającym tekst w języku irlandzkim. Obiekt OcrInput jest używany do załadowania obrazu, a metoda Ocr.Read przetwarza obraz w celu wyodrębnienia tekstu. Wynikowy tekst jest następnie przechowywany w zmiennej AllText i drukowany na konsolę.