OCR soundanais en C# et .NET

This article was translated from English: Does it need improvement?
Translated
View the article in English
Other versions of this document:

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

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

Ce package contient 52 langues OCR pour .NET :

  • Soundanais
  • SundaneseBest
  • SundanaisFast

Télécharger

Pack linguistique sundanais [sundanais]

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

Installation

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

Install-Package IronOCR.Languages.Sundanese

Exemple de code

Cet exemple de code C# lit du texte sundanais à partir d'une image ou d'un document PDF.

// Import the IronOcr namespace
using IronOcr;

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

        // Specify the language the OCR engine should use
        Ocr.Language = OcrLanguage.Sundanese;

        // Initialize the OCR input with an image file containing Sundanese text
        using (var Input = new OcrInput(@"images\Sundanese.png"))
        {
            // Process the input and get the result
            var Result = Ocr.Read(Input);

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

            // Output the recognized text
            System.Console.WriteLine(AllText);
        }
    }
}
// Import the IronOcr namespace
using IronOcr;

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

        // Specify the language the OCR engine should use
        Ocr.Language = OcrLanguage.Sundanese;

        // Initialize the OCR input with an image file containing Sundanese text
        using (var Input = new OcrInput(@"images\Sundanese.png"))
        {
            // Process the input and get the result
            var Result = Ocr.Read(Input);

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

            // Output the recognized text
            System.Console.WriteLine(AllText);
        }
    }
}
' Import the IronOcr namespace
Imports IronOcr

Friend Class Program
	Shared Sub Main()
		' Create a new instance of the IronTesseract class
		Dim Ocr = New IronTesseract()

		' Specify the language the OCR engine should use
		Ocr.Language = OcrLanguage.Sundanese

		' Initialize the OCR input with an image file containing Sundanese text
		Using Input = New OcrInput("images\Sundanese.png")
			' Process the input and get the result
			Dim Result = Ocr.Read(Input)

			' Extract all recognized text from the result
			Dim AllText = Result.Text

			' Output the recognized text
			System.Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel

Explication

  • Nous importons d'abord l'espace de noms IronOcr pour utiliser sa fonctionnalité OCR.
  • Une instance d' IronTesseract est créée, qui sert de moteur OCR principal.
  • Nous avons défini la propriété Language sur OcrLanguage.Sundanese pour indiquer que le moteur doit s'attendre à lire du texte en soundanais.
  • Nous créons un objet OcrInput pour spécifier la source du fichier image pour notre moteur OCR.
  • La méthode Read traite les données d'entrée et tente de reconnaître le texte.
  • Le texte reconnu est stocké dans la variable AllText puis affiché dans la console.

Cette configuration permet une reconnaissance fiable du texte en langue soundanaise à partir d'images grâce à la bibliothèque IronOCR dans un environnement .NET.