Lao OCR in C# and .NET

Other versions of this document:

IronOCR is a C# software component allowing .NET coders to read text from images and PDF documents in 126 languages, including Lao.

It is an advanced fork of Tesseract, built exclusively for .NET developers and regularly outperforms other Tesseract engines for both speed and accuracy.

Contents of IronOcr.Languages.Lao

This package contains multiple OCR language models for .NET:

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

Download

Lao Language Pack [ພາສາລາວ]

Installation

The first thing we have to do is install the Lao OCR package in your .NET project.

Install-Package IronOCR.Languages.Lao

Code Example

This C# code example reads Lao text from an Image or PDF document.

// 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

Explanation:

  • This code demonstrates how to configure and use IronOCR to perform OCR specifically for the Lao language.
  • IronTesseract is the main class used for performing OCR operations.
  • The language is set to Lao using Ocr.Language.
  • OcrInput is a class used to load images or PDF documents for OCR processing.
  • The Ocr.Read method processes the input and returns a result containing the recognized text.
  • The using statement ensures that resources are released after use.
  • Finally, the recognized text is printed to the console for output verification.