OCR Divehi en C# y .NET

This article was translated from English: Does it need improvement?
Translated
View the article in English

126 idiomas más

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, incluyendo Divehi.

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.Divehi

Este paquete contiene 43 idiomas OCR para .NET:

  • Divehi
  • DivehiBest
  • DivehiFast

Descargar

Paquete de idioma Divehi [ދވހ]

Instalación

Lo primero que necesitamos hacer es instalar el paquete OCR Divehi en tu proyecto .NET.

Install-Package IronOCR.Languages.Divehi

Ejemplo de código

Este ejemplo de código C# lee texto divehi de una imagen o documento PDF.

// Import the IronOcr namespace
using IronOcr;

class Program
{
    static void Main()
    {
        // Create an instance of the IronTesseract OCR engine
        var Ocr = new IronTesseract();

        // Set the OCR language to Divehi
        Ocr.Language = OcrLanguage.Divehi;

        // Load the image or PDF document into the OCR processor
        using (var Input = new OcrInput(@"images\Divehi.png"))
        {
            // Perform OCR on the input document
            var Result = Ocr.Read(Input);

            // Extract all recognized text
            var AllText = Result.Text;

            // Output the extracted text to the console
            Console.WriteLine(AllText);
        }
    }
}
// Import the IronOcr namespace
using IronOcr;

class Program
{
    static void Main()
    {
        // Create an instance of the IronTesseract OCR engine
        var Ocr = new IronTesseract();

        // Set the OCR language to Divehi
        Ocr.Language = OcrLanguage.Divehi;

        // Load the image or PDF document into the OCR processor
        using (var Input = new OcrInput(@"images\Divehi.png"))
        {
            // Perform OCR on the input document
            var Result = Ocr.Read(Input);

            // Extract all recognized text
            var AllText = Result.Text;

            // Output the extracted text to the console
            Console.WriteLine(AllText);
        }
    }
}
' Import the IronOcr namespace
Imports IronOcr

Friend Class Program
	Shared Sub Main()
		' Create an instance of the IronTesseract OCR engine
		Dim Ocr = New IronTesseract()

		' Set the OCR language to Divehi
		Ocr.Language = OcrLanguage.Divehi

		' Load the image or PDF document into the OCR processor
		Using Input = New OcrInput("images\Divehi.png")
			' Perform OCR on the input document
			Dim Result = Ocr.Read(Input)

			' Extract all recognized text
			Dim AllText = Result.Text

			' Output the extracted text to the console
			Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel

Explicación

  • Importación de IronOcr: El ejemplo comienza importando el espacio de nombres necesario de IronOcr.
  • Creación del motor OCR: Se crea una instancia de IronTesseract, el motor OCR.
  • Especificación del idioma: Se establece el idioma para el procesamiento OCR a Divehi, asegurando un reconocimiento preciso adaptado a ese idioma.
  • Carga de entrada: Se abre una imagen o documento PDF utilizando OcrInput, listo para la extracción de texto.
  • Realización de OCR: El método Read procesa la entrada y extrae el texto.
  • Extracción de texto: El texto reconocido se almacena en AllText y se imprime en la consola.

Este código muestra una forma simple pero poderosa de aprovechar IronOCR para leer el guion Divehi de documentos digitales.