Tonga OCR in C# and .NET

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

126 Weitere Sprachen

IronOCR ist eine C#-Softwarekomponente, die es .NET-Entwicklern ermöglicht, Text aus Bildern und PDF-Dokumenten in 126 Sprachen, einschließlich Tonga, zu lesen. Es ist ein fortschrittlicher Fork von Tesseract, der ausschließlich for .NET-Entwickler entwickelt wurde und regelmäßig andere Tesseract-Engines sowohl in Geschwindigkeit als auch Genauigkeit übertrifft.

Inhalt von IronOcr.Languages.Tonga

Dieses Paket enthält drei OCR-Sprachmodelle speziell für Tonga:

  • Tonga
  • TongaBest
  • TongaFast

Download

Tonga Sprachpaket [faka Tonga]

  • Als Zip-Datei herunterladen.
  • Mit NuGet installieren.

Installation

Um die Tonga-OCR-Funktionen zu nutzen, installieren Sie das Tonga-OCR-Paket in Ihr .NET-Projekt mit dem folgenden NuGet-Befehl:

Install-Package IronOcr.Languages.Tonga

Beispielcode

Das folgende C#-Codebeispiel zeigt, wie man Tonga-Text aus einem Bild oder PDF-Dokument mit IronOCR liest.

// Include the necessary IronOcr namespace
using IronOcr;

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

        // Set the OCR engine to use the Tonga language pack
        Ocr.Language = OcrLanguage.Tonga;

        // Load the input image or PDF into OcrInput
        using (var Input = new OcrInput(@"images\Tonga.png"))
        {
            // Perform OCR to read the text from the image
            var Result = Ocr.Read(Input);

            // Retrieve the full text recognition result
            var AllText = Result.Text;

            // Output the result or process further as needed
            System.Console.WriteLine(AllText);
        }
    }
}
// Include the necessary IronOcr namespace
using IronOcr;

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

        // Set the OCR engine to use the Tonga language pack
        Ocr.Language = OcrLanguage.Tonga;

        // Load the input image or PDF into OcrInput
        using (var Input = new OcrInput(@"images\Tonga.png"))
        {
            // Perform OCR to read the text from the image
            var Result = Ocr.Read(Input);

            // Retrieve the full text recognition result
            var AllText = Result.Text;

            // Output the result or process further as needed
            System.Console.WriteLine(AllText);
        }
    }
}
' Include the necessary IronOcr namespace
Imports IronOcr

Friend Class TongaOcrExample
	Shared Sub Main()
		' Initialize the IronTesseract OCR engine
		Dim Ocr = New IronTesseract()

		' Set the OCR engine to use the Tonga language pack
		Ocr.Language = OcrLanguage.Tonga

		' Load the input image or PDF into OcrInput
		Using Input = New OcrInput("images\Tonga.png")
			' Perform OCR to read the text from the image
			Dim Result = Ocr.Read(Input)

			' Retrieve the full text recognition result
			Dim AllText = Result.Text

			' Output the result or process further as needed
			System.Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel
  • Dieses Codebeispiel veranschaulicht die Initialisierung der IronTesseract-OCR-Engine und die Einstellung auf die Verwendung der Tonga-Sprache.
  • Wir laden ein Bild vom angegebenen Pfad in ein OcrInput Objekt. Die Methode Ocr.Read() verarbeitet die Eingabe, um Text zu extrahieren, und anschließend rufen wir den erkannten Text über die Eigenschaft Result.Text ab.
  • Schließlich kann der extrahierte Text nach Bedarf in der Anwendung ausgegeben oder verarbeitet werden.