English OCR in C# and .NET

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

126 więcej języków

IronOCR to komponent oprogramowania C#, który umożliwia programistom .NET odczytywanie tekstu z obrazów i dokumentów PDF w 126 językach, w tym po angielsku.

Jest to zaawansowany fork Tesseract, stworzony wyłącznie dla programistów .NET i regularnie przewyższa inne silniki Tesseract zarówno pod względem szybkości, jak i dokładności.

Zawartość IronOcr.Languages.English

Ten pakiet zawiera 64 języki OCR dla .NET:

Pobieranie

Pakiet języka angielskiego [nowoczesny angielski]

Przykład kodu

Ten przykład kodu C# odczytuje angielski tekst z obrazu lub dokumentu PDF.

// Import the IronOcr namespace
using IronOcr;

class Program
{
    static void Main()
    {
        // Initialize the IronTesseract OCR engine
        var Ocr = new IronTesseract();

        // Set the language to English
        Ocr.Language = OcrLanguage.English;

        // Define the input source as an image file
        using (var Input = new OcrInput(@"images\English.png"))
        {
            // Perform OCR to read the text from the input
            var Result = Ocr.Read(Input);

            // Get all the recognized text
            var AllText = Result.Text;

            // Output the recognized text
            Console.WriteLine(AllText);
        }
    }
}
// Import the IronOcr namespace
using IronOcr;

class Program
{
    static void Main()
    {
        // Initialize the IronTesseract OCR engine
        var Ocr = new IronTesseract();

        // Set the language to English
        Ocr.Language = OcrLanguage.English;

        // Define the input source as an image file
        using (var Input = new OcrInput(@"images\English.png"))
        {
            // Perform OCR to read the text from the input
            var Result = Ocr.Read(Input);

            // Get all the recognized text
            var AllText = Result.Text;

            // Output the recognized text
            Console.WriteLine(AllText);
        }
    }
}
Imports IronOcr

Class Program
    Shared Sub Main()
        ' Initialize the IronTesseract OCR engine
        Dim Ocr As New IronTesseract()

        ' Set the language to English
        Ocr.Language = OcrLanguage.English

        ' Define the input source as an image file
        Using Input As New OcrInput("images\English.png")
            ' Perform OCR to read the text from the input
            Dim Result = Ocr.Read(Input)

            ' Get all the recognized text
            Dim AllText = Result.Text

            ' Output the recognized text
            Console.WriteLine(AllText)
        End Using
    End Sub
End Class
$vbLabelText   $csharpLabel
  • Upewnij się, że masz zainstalowany pakiet IronOCR oraz odpowiedni pakiet językowy.
  • Ten przykład inicjalizuje silnik OCR, ustawia go na przetwarzanie angielskiego, czyta tekst z obrazu wejściowego i wyświetla rozpoznany tekst.