Tonga OCR in C# and .NET

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

126 wiecej jeżyków

IronOCR to komponent oprogramowania C#, który pozwala deweloperom .NET odczytywać tekst z obrazów i dokumentów PDF w 126 językach, w tym w języku Tonga. Jest to zaawansowany fork Tesseract, opracowany wyłącznie dla deweloperów .NET, który regularnie przewyższa inne silniki Tesseract zarówno pod względem szybkości, jak i dokładności.

Zawartość IronOcr.Languages.Tonga

Ten pakiet zawiera trzy modele językowe OCR specjalnie dla języka Tonga:

  • Tonga
  • TongaBest
  • TongaFast

Pobieranie

Tonga Language Pack [faka Tonga]

  • Pobierz jako plik Zip.
  • Zainstaluj za pomocą NuGet.

Instalacja

Aby rozpocząć korzystanie z możliwości OCR dla języka Tonga, zainstaluj pakiet Tonga OCR w projekcie .NET za pomocą następującego polecenia NuGet:

Install-Package IronOcr.Languages.Tonga

Przyklad kodu

Poniższy przykład kodu C# pokazuje, jak odczytać tekst w języku Tonga z obrazu lub dokumentu PDF za pomocą IronOCR.

// 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
  • Ten przykład kodu demonstruje inicjalizację silnika OCR IronTesseract i ustawienie go na używanie języka Tonga.
  • Ładujemy obraz z określonej ścieżki do obiektu OcrInput.
  • Metoda Ocr.Read() przetwarza dane wejściowe, aby wyodrębnić tekst, a następnie pobieramy rozpoznany tekst za pomocą właściwości Result.Text.
  • Ostatecznie, wyodrębniony tekst można wyprowadzić lub przetworzyć według potrzeb w aplikacji.