OCR catalane 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 catalan.

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

Ce package contient 46 langues OCR pour .NET :

  • Catalan
  • CatalanBest
  • CatalanFast

Télécharger

Pack de langue catalane [català]

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

Installation

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

Install-Package IronOCR.Languages.Catalan

Exemple de code

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

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

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

        // Set the language for OCR processing to Catalan
        Ocr.Language = OcrLanguage.Catalan;

        // Define the input image or PDF from which you want to read the text
        using (var Input = new OcrInput(@"images\Catalan.png"))
        {
            // Perform OCR reading on the input
            var Result = Ocr.Read(Input);

            // Retrieve all recognized text
            var AllText = Result.Text;

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

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

        // Set the language for OCR processing to Catalan
        Ocr.Language = OcrLanguage.Catalan;

        // Define the input image or PDF from which you want to read the text
        using (var Input = new OcrInput(@"images\Catalan.png"))
        {
            // Perform OCR reading on the input
            var Result = Ocr.Read(Input);

            // Retrieve all recognized text
            var AllText = Result.Text;

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

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

		' Set the language for OCR processing to Catalan
		Ocr.Language = OcrLanguage.Catalan

		' Define the input image or PDF from which you want to read the text
		Using Input = New OcrInput("images\Catalan.png")
			' Perform OCR reading on the input
			Dim Result = Ocr.Read(Input)

			' Retrieve all recognized text
			Dim AllText = Result.Text

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

Dans ce code :

  • Nous créons une instance d' IronTesseract pour gérer les opérations OCR.
  • La Ocr.Language est spécifiée comme étant catalane, ce qui indique que le moteur OCR doit traiter les images en utilisant le modèle de langue catalane.
  • Nous utilisons OcrInput pour spécifier le chemin d'accès au fichier image ou au document PDF.
  • La méthode Read est appelée sur l'objet Ocr , et les résultats de la lecture OCR sont stockés dans la variable Result . Enfin, Result.Text contient le texte reconnu, qui est affiché dans la console.