Traducir OCR 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 tigrinya. 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.Tigrinya

Este paquete contiene 49 idiomas OCR para .NET:

  • Tigrinya
  • TigrinyaBest
  • TigrinyaFast

Descargar

Paquete de idioma Tigrinya [ትግርኛ]

Instalación

Lo primero que debemos hacer es instalar el paquete de OCR de Tigrinya en su proyecto .NET.

Install-Package IronOCR.Languages.Tigrinya

Ejemplo de código

Este ejemplo de código C# lee texto Tigrinya de una imagen o documento PDF.

using IronOcr;

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

        // Set the OCR language to Tigrinya
        Ocr.Language = OcrLanguage.Tigrinya;

        // Using statement ensures the OcrInput object is disposed of after use
        using (var Input = new OcrInput(@"images\Tigrinya.png"))
        {
            // Perform OCR on the input image
            var Result = Ocr.Read(Input);

            // Extract all text recognized in the image and store it in a variable
            var AllText = Result.Text;

            // Output the extracted text
            Console.WriteLine(AllText);
        }
    }
}
using IronOcr;

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

        // Set the OCR language to Tigrinya
        Ocr.Language = OcrLanguage.Tigrinya;

        // Using statement ensures the OcrInput object is disposed of after use
        using (var Input = new OcrInput(@"images\Tigrinya.png"))
        {
            // Perform OCR on the input image
            var Result = Ocr.Read(Input);

            // Extract all text recognized in the image and store it in a variable
            var AllText = Result.Text;

            // Output the extracted text
            Console.WriteLine(AllText);
        }
    }
}
Imports IronOcr

Friend Class Program
	Shared Sub Main()
		' Create a new instance of IronTesseract to perform OCR
		Dim Ocr = New IronTesseract()

		' Set the OCR language to Tigrinya
		Ocr.Language = OcrLanguage.Tigrinya

		' Using statement ensures the OcrInput object is disposed of after use
		Using Input = New OcrInput("images\Tigrinya.png")
			' Perform OCR on the input image
			Dim Result = Ocr.Read(Input)

			' Extract all text recognized in the image and store it in a variable
			Dim AllText = Result.Text

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

Explicación

  • IronTesseract: Esta es una clase especializada de IronOCR utilizada para realizar el reconocimiento de texto.
  • Ocr.Language: Establece el idioma utilizado por el motor OCR. Para este caso, se establece en Tigrinya.
  • OcrInput: Representa la fuente de entrada, una imagen en este caso, que se convertirá en texto.
  • Ocr.Read(Input): Ejecuta OCR en la entrada especificada y devuelve los resultados.
  • Result.Text: Contiene el texto extraído de la imagen de entrada después del proceso de OCR.
  • Console.WriteLine(AllText): Muestra el texto extraído en la consola. Esta línea es opcional y se puede eliminar si no se necesita salida en la consola.