OCR catalán en C# y .NET
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, incluido el catalán.
Es una bifurcación avanzada de Tesseract, construida exclusivamente para desarrolladores .NET, y regularmente supera a otros motores Tesseract tanto en velocidad como en precisión.
Contenido de IronOcr.Languages.Catalan
Este paquete contiene 46 idiomas OCR para .NET:
- Catalán
- CatalanBest
- CatalanFast
Descargar
Paquete de idioma catalán [català]
Instalación
Lo primero que tenemos que hacer es instalar nuestro paquete OCR de catalán en su proyecto .NET.
Install-Package IronOCR.Languages.Catalan
Ejemplo de código
Este ejemplo de código en C# lee texto en catalán de una imagen o documento PDF.
// Import the IronOcr namespace to use its OCR functionality
using IronOcr;
class CatalanOcrExample
{
static void Main()
{
// Create a new instance of the IronTesseract class
var Ocr = new IronTesseract();
// Set the language for OCR processing to Catalan
Ocr.Language = OcrLanguage.Catalan;
// Define the input image or PDF from which you want to read the text
using (var Input = new OcrInput(@"images\Catalan.png"))
{
// Perform OCR reading on the input
var Result = Ocr.Read(Input);
// Retrieve all recognized text
var AllText = Result.Text;
// Output the recognized text
Console.WriteLine(AllText);
}
}
}// Import the IronOcr namespace to use its OCR functionality
using IronOcr;
class CatalanOcrExample
{
static void Main()
{
// Create a new instance of the IronTesseract class
var Ocr = new IronTesseract();
// Set the language for OCR processing to Catalan
Ocr.Language = OcrLanguage.Catalan;
// Define the input image or PDF from which you want to read the text
using (var Input = new OcrInput(@"images\Catalan.png"))
{
// Perform OCR reading on the input
var Result = Ocr.Read(Input);
// Retrieve all recognized text
var AllText = Result.Text;
// Output the recognized text
Console.WriteLine(AllText);
}
}
}' Import the IronOcr namespace to use its OCR functionality
Imports IronOcr
Friend Class CatalanOcrExample
Shared Sub Main()
' Create a new instance of the IronTesseract class
Dim Ocr = New IronTesseract()
' Set the language for OCR processing to Catalan
Ocr.Language = OcrLanguage.Catalan
' Define the input image or PDF from which you want to read the text
Using Input = New OcrInput("images\Catalan.png")
' Perform OCR reading on the input
Dim Result = Ocr.Read(Input)
' Retrieve all recognized text
Dim AllText = Result.Text
' Output the recognized text
Console.WriteLine(AllText)
End Using
End Sub
End ClassEn este código:
- Creamos una instancia de
IronTesseractpara manejar las operaciones de OCR. - Se especifica
Ocr.Languagecomo catalán, indicando que el motor OCR debe procesar imágenes utilizando el modelo de idioma catalán. - Usamos
OcrInputpara especificar la ruta del archivo de la imagen o documento PDF. - Se llama al método
Readen el objetoOcr, y los resultados de la lectura OCR se almacenan en la variableResult. - Finalmente,
Result.Textcontiene el texto reconocido, que se imprime en la consola.





