OCR bengalí en C# y .NET

This article was translated from English: Does it need improvement?
Translated
View the article in English
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);
        }
    }
}
' 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
$vbLabelText   $csharpLabel

Explicación

  1. Importar IronOcr: Comenzamos importando el espacio de nombres IronOcr, que contiene clases y métodos necesarios para realizar operaciones de OCR.

  2. Crear instancia de IronTesseract: Creamos una instancia de IronTesseract, que es la clase principal para realizar OCR.

  3. Establecer idioma: Establecemos el idioma OCR a bengalí usando OcrLanguage.Bengali.

  4. OcrInput: Especificamos la ruta a la imagen de la cual queremos extraer texto. Se utiliza un objeto OcrInput para cargar y preprocesar el archivo de entrada.

  5. Leer y extraer texto: Usando el método Read, procesamos la imagen para leer el contenido del texto. El texto se almacena en Result.Text.

  6. Salida de texto: Finalmente, imprimimos el texto extraído en la consola para verificar la salida.