OCR italiano en C# y .NET
Other versions of this document:
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 italiano.
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.Italian
Este paquete contiene 6 modos de idioma OCR para .NET:
- Italiano
- ItalianoMejor
- ItalianoRápido
- ItalianoAntiguo
- ItalianoAntiguoMejor
- ItalianoAntiguoRápido
Descargar
Paquete de idioma italiano [italiano]
Instalación
Lo primero que tenemos que hacer es instalar el paquete OCR Italiano en tu proyecto .NET.
Install-Package IronOCR.Languages.Italian
Ejemplo de código
Este ejemplo de código C# lee texto en italiano de una imagen o documento PDF.
// Include IronOcr library
using IronOcr;
class Program
{
static void Main()
{
// Create a new instance of the IronTesseract class
var Ocr = new IronTesseract();
// Set the OCR language to Italian
Ocr.Language = OcrLanguage.Italian;
// Read text from an image file
using (var Input = new OcrInput(@"images\Italian.png"))
{
// Perform OCR to get the text content from the image
var Result = Ocr.Read(Input);
// Get and print all the recognized text
var AllText = Result.Text;
Console.WriteLine(AllText);
}
}
}// Include IronOcr library
using IronOcr;
class Program
{
static void Main()
{
// Create a new instance of the IronTesseract class
var Ocr = new IronTesseract();
// Set the OCR language to Italian
Ocr.Language = OcrLanguage.Italian;
// Read text from an image file
using (var Input = new OcrInput(@"images\Italian.png"))
{
// Perform OCR to get the text content from the image
var Result = Ocr.Read(Input);
// Get and print all the recognized text
var AllText = Result.Text;
Console.WriteLine(AllText);
}
}
}' Include IronOcr library
Imports IronOcr
Friend Class Program
Shared Sub Main()
' Create a new instance of the IronTesseract class
Dim Ocr = New IronTesseract()
' Set the OCR language to Italian
Ocr.Language = OcrLanguage.Italian
' Read text from an image file
Using Input = New OcrInput("images\Italian.png")
' Perform OCR to get the text content from the image
Dim Result = Ocr.Read(Input)
' Get and print all the recognized text
Dim AllText = Result.Text
Console.WriteLine(AllText)
End Using
End Sub
End ClassExplicación:
- Usando IronOCR: La biblioteca
IronOcrse incluye para utilizar sus capacidades de OCR. - Creando una instancia de IronTesseract:
IronTesseractes una clase principal utilizada para el procesamiento de OCR. - Estableciendo el idioma: El OCR está configurado para procesar el idioma italiano usando
Ocr.Language = OcrLanguage.Italian. - Lectura de entrada: Se crea un objeto
OcrInputpara especificar el archivo de imagen. - Realización de OCR:
Ocr.Read(Input)ejecuta el proceso de OCR en la imagen de entrada y devuelve el texto resultante. - Salida: El texto resultante se almacena en
AllTexty se muestra en la consola.
Asegúrate de que la ruta del archivo images\Italian.png sea correcta y que el archivo exista para que el ejemplo funcione correctamente.





