Icelandic 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 ist eine C# Softwarekomponente, die es .NET-Entwicklern ermöglicht, Text aus Bildern und PDF-Dokumenten in 126 Sprachen, einschließlich Isländisch, zu lesen. Es ist ein fortschrittlicher Fork von Tesseract, der ausschließlich für .NET-Entwickler entwickelt wurde und regelmäßig andere Tesseract-Engines sowohl in Geschwindigkeit als auch Genauigkeit übertrifft.

Inhalt von IronOcr.Languages.Icelandic

Dieses Paket enthält 52 OCR-Sprachen für .NET:

  • Isländisch
  • IsländischBest
  • IsländischFast

Download

Isländisches Sprachpaket style='white-space:default'>[Íslenska]

Installation

Das Erste, was wir tun müssen, ist, unser Isländisches OCR-Paket zu Ihrem .NET-Projekt zu installieren.

Install-Package IronOCR.Languages.Icelandic

Beispielcode

Dieses C# Codebeispiel liest isländischen Text aus einem Bild oder PDF-Dokument.

using IronOcr;

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

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

        // Load the image or PDF file to be processed
        using (var Input = new OcrInput(@"images\Icelandic.png"))
        {
            // Perform OCR on the input file
            var Result = Ocr.Read(Input);

            // Extract all recognized text from the result
            var AllText = Result.Text;

            // Print the extracted text to the console
            System.Console.WriteLine(AllText);
        }
    }
}
using IronOcr;

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

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

        // Load the image or PDF file to be processed
        using (var Input = new OcrInput(@"images\Icelandic.png"))
        {
            // Perform OCR on the input file
            var Result = Ocr.Read(Input);

            // Extract all recognized text from the result
            var AllText = Result.Text;

            // Print the extracted text to the console
            System.Console.WriteLine(AllText);
        }
    }
}
Imports IronOcr

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

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

		' Load the image or PDF file to be processed
		Using Input = New OcrInput("images\Icelandic.png")
			' Perform OCR on the input file
			Dim Result = Ocr.Read(Input)

			' Extract all recognized text from the result
			Dim AllText = Result.Text

			' Print the extracted text to the console
			System.Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel

Erklärung

  • Die IronTesseract-Klasse ist Teil der IronOcr-Bibliothek, die zur Durchführung von OCR-Operationen entwickelt wurde.
  • Ocr.Language = OcrLanguage.Icelandic; setzt die OCR-Sprache auf Isländisch.
  • OcrInput nimmt den Pfad zur Eingabedatei (ein Bild oder ein PDF) und bereitet sie zur Verarbeitung vor.
  • Ocr.Read(Input) verarbeitet die Eingabedatei und gibt das OCR-Ergebnis zurück.
  • Result.Text ruft allen erkannten Text aus der verarbeiteten Eingabe ab.

Stellen Sie sicher, dass Sie die IronOCR-Bibliothek und ihr isländisches Sprachpaket in Ihrem .NET-Projekt installiert haben, um dieses Beispiel erfolgreich auszuführen.