Reconocimiento óptico de caracteres (OCR) de Tonga en C# y .NET

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

126 idiomas más

IronOCR es un componente de software C# que permite a los desarrolladores .NET leer texto de imágenes y documentos PDF en 126 idiomas, incluido el Tonga. Es una bifurcación avanzada de Tesseract, diseñada exclusivamente para desarrolladores .NET, que regularmente supera a otros motores de Tesseract tanto en velocidad como en precisión.

Contenido de IronOcr.Languages.Tonga

Este paquete contiene tres modelos de lenguaje OCR específicamente para Tonga:

  • Tonga
  • TongaBest
  • TongaFast

Descargar

Paquete de idioma Tonga [faka Tonga]

  • Descargue como un archivo Zip.
  • Instale con NuGet.

Instalación

Para empezar a usar las capacidades de OCR de Tonga, instale el paquete de OCR de Tonga en su proyecto .NET utilizando el siguiente comando de NuGet:

Install-Package IronOCR.Languages.Tonga

Ejemplo de código

El siguiente ejemplo de código C# demuestra cómo leer texto en Tonga desde una imagen o documento PDF utilizando 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
  • Este ejemplo de código demuestra la inicialización del motor de OCR IronTesseract y su configuración para utilizar el idioma Tonga.
  • Cargamos una imagen desde la ruta especificada en un objeto OcrInput.
  • El método Ocr.Read() procesa la entrada para extraer texto, y luego recuperamos el texto reconocido a través de la propiedad Result.Text.
  • Finalmente, el texto extraído se puede emitir o procesar según sea necesario en la aplicación.