Divehi OCR in C# and .NET

126 More Languages

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

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

This package contains 43 OCR languages for .NET:

  • Divehi
  • DivehiBest
  • DivehiFast

Download

Divehi Language Pack [ދިވެހި]

Installation

The first thing we need to do is install the Divehi OCR package to your .NET project.

Install-Package IronOCR.Languages.Divehi

Code Example

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

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

Explanation

  • Importing IronOcr: The example begins by importing the necessary IronOcr namespace.
  • Creating OCR Engine: An instance of IronTesseract, the OCR engine, is created.
  • Specifying Language: The language for OCR processing is set to Divehi, ensuring accurate recognition tailored for that language.
  • Loading Input: An image or PDF document is opened using OcrInput, ready for text extraction.
  • Performing OCR: The Read method processes the input and extracts text.
  • Text Extraction: The recognized text is stored in AllText and printed to the console.

This code showcases a simple yet powerful way to leverage IronOCR for reading Divehi script from digital documents.