OCR bengalí en C# y .NET
Other versions of this document:
IronOCR es un componente de software C# que permite a los codificadores de .NET leer texto de imágenes y documentos PDF en 126 idiomas, incluido el bengalí. 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.Bengali
Este paquete contiene 114 idiomas OCR para .NET:
- Bengalí
- BengaliBest
- BengaliFast
- BengaliAlphabet
- BengaliAlphabetBest
- BengaliAlphabetFast
Descargar
Paquete de idiomas bengalí [Bangla]
Instalación
Lo primero que tenemos que hacer es instalar nuestro paquete de OCR Bengalí en tu proyecto .NET.
Install-Package IronOCR.Languages.Bengali
Ejemplo de código
Este ejemplo de código C# lee texto bengalí de una imagen o documento PDF.
// Import the IronOcr namespace
using IronOcr;
class BengaliOcrExample
{
static void Main()
{
// Create an instance of IronTesseract
var Ocr = new IronTesseract();
// Specify the language for OCR
Ocr.Language = OcrLanguage.Bengali;
// Process the image and extract text
using (var Input = new OcrInput(@"images\Bengali.png"))
{
// Perform OCR on the input image
var Result = Ocr.Read(Input);
// Get the extracted text
var AllText = Result.Text;
// Output the extracted text to the console
System.Console.WriteLine(AllText);
}
}
}// Import the IronOcr namespace
using IronOcr;
class BengaliOcrExample
{
static void Main()
{
// Create an instance of IronTesseract
var Ocr = new IronTesseract();
// Specify the language for OCR
Ocr.Language = OcrLanguage.Bengali;
// Process the image and extract text
using (var Input = new OcrInput(@"images\Bengali.png"))
{
// Perform OCR on the input image
var Result = Ocr.Read(Input);
// Get the extracted text
var AllText = Result.Text;
// Output the extracted text to the console
System.Console.WriteLine(AllText);
}
}
}Explicación
Importar IronOcr: Comenzamos importando el espacio de nombres
IronOcr, que contiene clases y métodos necesarios para realizar operaciones de OCR.Crear instancia de IronTesseract: Creamos una instancia de
IronTesseract, que es la clase principal para realizar OCR.Establecer idioma: Establecemos el idioma OCR a bengalí usando
OcrLanguage.Bengali.OcrInput: Especificamos la ruta a la imagen de la cual queremos extraer texto. Se utiliza un objeto
OcrInputpara cargar y preprocesar el archivo de entrada.Leer y extraer texto: Usando el método
Read, procesamos la imagen para leer el contenido del texto. El texto se almacena enResult.Text.- Salida de texto: Finalmente, imprimimos el texto extraído en la consola para verificar la salida.





