OCR galé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 en C# que permite a los programadores de .NET leer texto de imágenes y documentos PDF en 126 idiomas, incluyendo galés. Es una versión avanzada de Tesseract, construida exclusivamente para desarrolladores de .NET y que supera regularmente a otros motores Tesseract tanto en velocidad como en precisión.

Contenido de IronOcr.Languages.Welsh

Este paquete contiene tres versiones del idioma OCR galés para .NET:

  • Galés
  • GalésMejor
  • GalésRápido

Descargar

Paquete de idioma galés [Cymraeg]

Instalación

El primer paso es instalar el paquete OCR galés en su proyecto .NET.

Install-Package IronOCR.Languages.Welsh

Ejemplo de código

Este ejemplo de código en C# demuestra cómo leer texto en galés desde una imagen o documento PDF.

// Import the IronOcr namespace
using IronOcr;

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

        // Set the language to Welsh
        Ocr.Language = OcrLanguage.Welsh;

        // Read text from the given image
        using (var Input = new OcrInput(@"images\Welsh.png"))
        {
            // Perform OCR and get the result
            var Result = Ocr.Read(Input);

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

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

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

        // Set the language to Welsh
        Ocr.Language = OcrLanguage.Welsh;

        // Read text from the given image
        using (var Input = new OcrInput(@"images\Welsh.png"))
        {
            // Perform OCR and get the result
            var Result = Ocr.Read(Input);

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

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

Friend Class Program
	Shared Sub Main()
		' Create an instance of IronTesseract
		Dim Ocr = New IronTesseract()

		' Set the language to Welsh
		Ocr.Language = OcrLanguage.Welsh

		' Read text from the given image
		Using Input = New OcrInput("images\Welsh.png")
			' Perform OCR and get the result
			Dim Result = Ocr.Read(Input)

			' Extract all recognized text
			Dim AllText = Result.Text

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

En este código:

  • Comenzamos usando el espacio de nombres IronOcr para acceder a las funcionalidades de OCR.
  • Creamos una instancia de IronTesseract, que es la clase principal proporcionada por IronOCR para realizar operaciones OCR.
  • El idioma de OCR se establece en galés usando Ocr.Language = OcrLanguage.Welsh.
  • Abrimos un archivo de imagen llamado Welsh.png ubicado en el directorio images para el procesamiento OCR.
  • Finalmente, el método Ocr.Read(Input) lee el texto de la imagen, y el texto extraído se almacena en AllText.
  • El texto galés reconocido se imprime luego en la consola.