OCR sundanés en C# y .NET

This article was translated from English: Does it need improvement?
Translated
View the article in English
Other versions of this document:

IronOCR es un componente de software C# que permite a los programadores de .NET leer texto de imágenes y documentos PDF en 126 idiomas, incluyendo Sundanés.

Es una rama avanzada de Tesseract, construida exclusivamente para desarrolladores de .NET y supera regularmente a otros motores de Tesseract tanto en velocidad como en precisión.

Contenido de IronOcr.Languages.Sundanese

Este paquete contiene 52 idiomas de OCR para .NET:

  • Sundanés
  • SundaneseBest
  • SundaneseFast

Descargar

Paquete de Idioma Sundanés [Basa Sunda]

Instalación

Lo primero que debemos hacer es instalar nuestro paquete OCR Sundanés en tu proyecto .NET.

Install-Package IronOCR.Languages.Sundanese

Ejemplo de código

Este ejemplo de código C# lee texto en Sundanés de una imagen o documento PDF.

// Import the IronOcr namespace
using IronOcr;

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

        // Specify the language the OCR engine should use
        Ocr.Language = OcrLanguage.Sundanese;

        // Initialize the OCR input with an image file containing Sundanese text
        using (var Input = new OcrInput(@"images\Sundanese.png"))
        {
            // Process the input and get the result
            var Result = Ocr.Read(Input);

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

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

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

        // Specify the language the OCR engine should use
        Ocr.Language = OcrLanguage.Sundanese;

        // Initialize the OCR input with an image file containing Sundanese text
        using (var Input = new OcrInput(@"images\Sundanese.png"))
        {
            // Process the input and get the result
            var Result = Ocr.Read(Input);

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

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

Friend Class Program
	Shared Sub Main()
		' Create a new instance of the IronTesseract class
		Dim Ocr = New IronTesseract()

		' Specify the language the OCR engine should use
		Ocr.Language = OcrLanguage.Sundanese

		' Initialize the OCR input with an image file containing Sundanese text
		Using Input = New OcrInput("images\Sundanese.png")
			' Process the input and get the result
			Dim Result = Ocr.Read(Input)

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

			' Output the recognized text
			System.Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel

Explicación

  • Primero importamos el espacio de nombres IronOcr para usar su funcionalidad OCR.
  • Se crea una instancia de IronTesseract, que actúa como nuestro motor OCR principal.
  • Establecemos la propiedad Language en OcrLanguage.Sundanese para especificar que el motor debe esperar leer texto en Sundanés.
  • Creamos un objeto OcrInput para especificar la fuente del archivo de imagen para nuestro motor OCR.
  • El método Read procesa la entrada e intenta reconocer texto.
  • El texto reconocido se almacena en la variable AllText y posteriormente se imprime en la consola.

Esta configuración permite un reconocimiento robusto del texto en idioma Sundanés a partir de imágenes, utilizando la biblioteca IronOCR en un entorno .NET.