OCR del alfabeto latino en C# y .NET
IronOCR es un componente de software C# que permite a los programadores de .NET leer texto de imágenes y documentos PDF en 126 idiomas, incluido el alfabeto latino.
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.LatinAlphabet
Este paquete contiene 64 idiomas OCR para .NET:
- LatinAlphabet
- LatinAlphabetBest
- LatinAlphabetFast
Descargar
Paquete de idioma del alfabeto latino [latine]
Instalación
Lo primero que tenemos que hacer es instalar nuestro paquete OCR del alfabeto latino en su proyecto .NET.
Install-Package IronOCR.Languages.LatinAlphabet
Ejemplo de código
Este ejemplo de código C# lee texto del alfabeto latino de una imagen o documento PDF.
// Install the IronOCR.languages.LatinAlphabet package first
using IronOcr;
var Ocr = new IronTesseract(); // Initialize IronTesseract instance
// Set the OCR language to LatinAlphabet
Ocr.Language = OcrLanguage.LatinAlphabet;
// Define the input image or PDF you want to read
using (var Input = new OcrInput(@"images\LatinAlphabet.png"))
{
// Perform OCR reading on the input
var Result = Ocr.Read(Input);
// Extract the recognized text
var AllText = Result.Text;
// Output the recognized text
Console.WriteLine(AllText);
}// Install the IronOCR.languages.LatinAlphabet package first
using IronOcr;
var Ocr = new IronTesseract(); // Initialize IronTesseract instance
// Set the OCR language to LatinAlphabet
Ocr.Language = OcrLanguage.LatinAlphabet;
// Define the input image or PDF you want to read
using (var Input = new OcrInput(@"images\LatinAlphabet.png"))
{
// Perform OCR reading on the input
var Result = Ocr.Read(Input);
// Extract the recognized text
var AllText = Result.Text;
// Output the recognized text
Console.WriteLine(AllText);
}' Install the IronOCR.languages.LatinAlphabet package first
Imports IronOcr
Private Ocr = New IronTesseract() ' Initialize IronTesseract instance
' Set the OCR language to LatinAlphabet
Ocr.Language = OcrLanguage.LatinAlphabet
' Define the input image or PDF you want to read
Using Input = New OcrInput("images\LatinAlphabet.png")
' Perform OCR reading on the input
Dim Result = Ocr.Read(Input)
' Extract the recognized text
Dim AllText = Result.Text
' Output the recognized text
Console.WriteLine(AllText)
End UsingExplicación
Inicialización de IronTesseract: Se inicializa una instancia de
IronTesseract, que manejará el procesamiento de OCR.Configuración del idioma: El idioma OCR se establece en
LatinAlphabet, que es uno de los idiomas disponibles en el paquete IronOCR.Especificación de entrada: Se crea un objeto
OcrInput, especificando la ruta a la imagen o PDF de la que se extraerá el texto.Ejecución de OCR: Se llama al método
Readde la instancia deIronTesseractpara procesar elOcrInput. Esto devuelve un objetoResultque contiene el texto extraído.Extracción de texto: Se utiliza la propiedad
Textdel objetoResultpara acceder al texto reconocido.- Salida: El texto reconocido se imprime en la consola para verificación.
Asegúrese de que la ruta del archivo en OcrInput apunte correctamente a su archivo de imagen o PDF para evitar excepciones de archivo no encontrado.





