OCR en español 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 .NET leer texto de imágenes y documentos PDF en 126 idiomas, incluido el español.

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.Spanish

Este paquete contiene varias opciones de idioma OCR para .NET:

  • Español
  • EspañolMejorado
  • EspañolRápido
  • EspañolAntiguo
  • EspañolAntiguoMejorado
  • EspañolAntiguoRápido

Descargar

Paquete de Idioma Español [español]

Instalación

Lo primero que tenemos que hacer es instalar nuestro paquete OCR en español en tu proyecto .NET.

Install-Package IronOCR.Languages.Spanish

Ejemplo de código

Este ejemplo de código C# lee texto en español de una imagen o documento PDF.

// Import the IronOcr namespace
using IronOcr;

// Create a new instance of the IronTesseract class
var Ocr = new IronTesseract();

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

// Use a using block to manage the OcrInput resource
using (var Input = new OcrInput(@"images\Spanish.png"))
{
    // Perform OCR on the input image
    var Result = Ocr.Read(Input);

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

    // The 'AllText' variable now contains the Spanish text
}
// Import the IronOcr namespace
using IronOcr;

// Create a new instance of the IronTesseract class
var Ocr = new IronTesseract();

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

// Use a using block to manage the OcrInput resource
using (var Input = new OcrInput(@"images\Spanish.png"))
{
    // Perform OCR on the input image
    var Result = Ocr.Read(Input);

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

    // The 'AllText' variable now contains the Spanish text
}
' Import the IronOcr namespace
Imports IronOcr

' Create a new instance of the IronTesseract class
Private Ocr = New IronTesseract()

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

' Use a using block to manage the OcrInput resource
Using Input = New OcrInput("images\Spanish.png")
	' Perform OCR on the input image
	Dim Result = Ocr.Read(Input)

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

	' The 'AllText' variable now contains the Spanish text
End Using
$vbLabelText   $csharpLabel

El código anterior demuestra cómo utilizar la biblioteca IronOCR para leer y extraer texto español de un archivo de imagen llamado Spanish.png. Asegúrese de incluir los espacios de nombres necesarios y manejar los recursos adecuadamente dentro de bloques using donde sea necesario.