OCR de Lao 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 en C# que permite a los programadores de .NET leer texto de imágenes y documentos PDF en 126 idiomas, incluyendo el lao.

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

Este paquete contiene múltiples modelos de idioma OCR para .NET:

  • Lao
  • LaoBest
  • LaoFast
  • LaoAlphabet
  • LaoAlphabetBest
  • LaoAlphabetFast

Descargar

Paquete de idioma Lao [ພາສາລາວ]

Instalación

Lo primero que tenemos que hacer es instalar el paquete de OCR Lao en tu proyecto .NET.

Install-Package IronOCR.Languages.Lao

Ejemplo de código

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

// Import the IronOcr namespace to use its OCR functionality
using IronOcr;

// Create a new IronTesseract instance
var Ocr = new IronTesseract();
// Set the OCR language to Lao
Ocr.Language = OcrLanguage.Lao;

// Use a using statement to ensure proper disposal of resources
using (var Input = new OcrInput(@"images\Lao.png"))
{
    // Perform OCR on the input image
    var Result = Ocr.Read(Input);
    // Extract all text from the OCR result
    var AllText = Result.Text;

    // Output the recognized text for verification
    Console.WriteLine(AllText);
}
// Import the IronOcr namespace to use its OCR functionality
using IronOcr;

// Create a new IronTesseract instance
var Ocr = new IronTesseract();
// Set the OCR language to Lao
Ocr.Language = OcrLanguage.Lao;

// Use a using statement to ensure proper disposal of resources
using (var Input = new OcrInput(@"images\Lao.png"))
{
    // Perform OCR on the input image
    var Result = Ocr.Read(Input);
    // Extract all text from the OCR result
    var AllText = Result.Text;

    // Output the recognized text for verification
    Console.WriteLine(AllText);
}
' Import the IronOcr namespace to use its OCR functionality
Imports IronOcr

' Create a new IronTesseract instance
Private Ocr = New IronTesseract()
' Set the OCR language to Lao
Ocr.Language = OcrLanguage.Lao

' Use a using statement to ensure proper disposal of resources
Using Input = New OcrInput("images\Lao.png")
	' Perform OCR on the input image
	Dim Result = Ocr.Read(Input)
	' Extract all text from the OCR result
	Dim AllText = Result.Text

	' Output the recognized text for verification
	Console.WriteLine(AllText)
End Using
$vbLabelText   $csharpLabel

Explicación:

  • Este código demuestra cómo configurar y usar IronOCR para realizar OCR específicamente para el idioma lao.
  • IronTesseract es la clase principal usada para realizar operaciones de OCR.
  • El idioma se establece en lao usando Ocr.Language.
  • OcrInput es una clase usada para cargar imágenes o documentos PDF para el procesamiento de OCR.
  • El método Ocr.Read procesa la entrada y devuelve un resultado que contiene el texto reconocido.
  • La instrucción using asegura que los recursos se liberen después de su uso.
  • Finalmente, el texto reconocido se imprime en la consola para verificar la salida.