Bengali OCR in C# and .NET
Otras versiones de este documento:
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 for .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);
}
}
}
' Import the IronOcr namespace
Imports IronOcr
Friend Class BengaliOcrExample
Shared Sub Main()
' Create an instance of IronTesseract
Dim Ocr = New IronTesseract()
' Specify the language for OCR
Ocr.Language = OcrLanguage.Bengali
' Process the image and extract text
Using Input = New OcrInput("images\Bengali.png")
' Perform OCR on the input image
Dim Result = Ocr.Read(Input)
' Get the extracted text
Dim AllText = Result.Text
' Output the extracted text to the console
System.Console.WriteLine(AllText)
End Using
End Sub
End Class
Explicación
-
Importar IronOCR: Comenzamos importando el espacio de nombres
IronOcr, que contiene las clases y los 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 de OCR en 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: utilizando el método
Read, procesamos la imagen para leer el contenido de texto. El texto se almacena enResult.Text. - Salida de texto: Finalmente, imprimimos el texto extraído en la consola para verificar la salida.

