Divehi OCR en C# et .NET

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

126 autres langues

IronOCR est un composant logiciel C# permettant aux développeurs .NET de lire du texte à partir d'images et de documents PDF dans 126 langues, dont le divehi.

Il s'agit d'une version avancée de Tesseract, conçue exclusivement pour les développeurs .NET et qui surpasse régulièrement les autres moteurs Tesseract en termes de vitesse et de précision.

Contenu de IronOcr.Languages.Divehi

Ce package contient 43 langues OCR pour .NET :

  • Divehi
  • DivehiBest
  • DivehiFast

Télécharger

Pack de langue Divehi [ދވހ]

  • Télécharger au format Zip
  • Installer avec NuGet

Installation

La première chose à faire est d'installer le package Divehi OCR sur votre projet .NET.

Install-Package IronOCR.Languages.Divehi

Exemple de code

Cet exemple de code C# lit du texte Divehi à partir d'une image ou d'un document 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

Explication

  • Importation d'IronOcr : L'exemple commence par l'importation de l'espace de noms IronOcr nécessaire.
  • Création du moteur OCR : Une instance d' IronTesseract , le moteur OCR, est créée.
  • Spécification de la langue : La langue du traitement OCR est définie sur Divehi, garantissant une reconnaissance précise adaptée à cette langue.
  • Chargement des données d'entrée : Une image ou un document PDF est ouvert à l'aide OcrInput , prêt pour l'extraction de texte.
  • Réalisation de l'OCR : La méthode Read extrait le texte des données d'entrée.
  • Extraction de texte : Le texte reconnu est stocké dans AllText et affiché sur la console.

Ce code illustre une méthode simple mais puissante pour exploiter IronOCR afin de lire l'écriture Divehi à partir de documents numériques.