OCR gallego en C# y .NET
Other versions of this document:
IronOCR es un componente de software C# que permite a los desarrolladores de .NET extraer texto de imágenes y documentos PDF en 126 idiomas, incluido el gallego.
Es un fork avanzado de Tesseract, diseñado específicamente para desarrolladores .NET, y supera consistentemente a otros motores Tesseract tanto en velocidad como en precisión.
Contenido de IronOcr.Languages.Galician
Este paquete contiene 49 idiomas OCR para .NET, incluyendo:
- Galician
- GalicianBest
- GalicianFast
Descargar
Paquete de idioma gallego [galego]
Instalación
El primer paso para utilizar el paquete de OCR gallego en su proyecto .NET es instalarlo.
Install-Package IronOCR.Languages.Galician
Ejemplo de código
El siguiente ejemplo de código C# demuestra cómo leer texto gallego de una imagen o documento PDF.
// Include the IronOcr library
using IronOcr;
class Program
{
static void Main()
{
// Instantiate the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Specify the language for OCR as Galician
Ocr.Language = OcrLanguage.Galician;
// Define the input source, here it is an image file
using (var Input = new OcrInput(@"images\Galician.png"))
{
// Perform the OCR process on the input image
var Result = Ocr.Read(Input);
// Retrieve the recognized text from the OCR result
var AllText = Result.Text;
// Output the extracted text to the console
Console.WriteLine(AllText);
}
}
}// Include the IronOcr library
using IronOcr;
class Program
{
static void Main()
{
// Instantiate the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Specify the language for OCR as Galician
Ocr.Language = OcrLanguage.Galician;
// Define the input source, here it is an image file
using (var Input = new OcrInput(@"images\Galician.png"))
{
// Perform the OCR process on the input image
var Result = Ocr.Read(Input);
// Retrieve the recognized text from the OCR result
var AllText = Result.Text;
// Output the extracted text to the console
Console.WriteLine(AllText);
}
}
}' Include the IronOcr library
Imports IronOcr
Friend Class Program
Shared Sub Main()
' Instantiate the IronTesseract OCR engine
Dim Ocr = New IronTesseract()
' Specify the language for OCR as Galician
Ocr.Language = OcrLanguage.Galician
' Define the input source, here it is an image file
Using Input = New OcrInput("images\Galician.png")
' Perform the OCR process on the input image
Dim Result = Ocr.Read(Input)
' Retrieve the recognized text from the OCR result
Dim AllText = Result.Text
' Output the extracted text to the console
Console.WriteLine(AllText)
End Using
End Sub
End ClassEn el código anterior:
- Usamos la clase IronTesseract para crear un objeto de motor OCR.
- Establecemos el idioma OCR a gallego, lo que asegura que el motor OCR procese con precisión el texto gallego.
- Luego leemos el archivo de imagen ubicado en "images\Galician.png" y obtenemos el texto reconocido.
- Finalmente, imprimimos el texto reconocido en la consola.





