OCR persan 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 persan.

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

Ce package contient 46 langues OCR pour .NET :

  • Persan
  • PersianBest
  • PersianFast

Télécharger

Pack de langue persane [persan]

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

Installation

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

PM> Install-Package IronOCR.Languages.Persian

Exemple de code

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

// Install IronOcr.Languages.Persian package using NuGet Package Manager
// PM> Install-Package IronOcr.Languages.Persian

using IronOcr;

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

        // Set the language to Persian
        Ocr.Language = OcrLanguage.Persian;

        // Load input image or PDF file
        using (var Input = new OcrInput(@"images\Persian.png"))
        {
            // Perform OCR to read text from the image
            var Result = Ocr.Read(Input);

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

            // Display the extracted text
            Console.WriteLine(AllText);
        }
    }
}
// Install IronOcr.Languages.Persian package using NuGet Package Manager
// PM> Install-Package IronOcr.Languages.Persian

using IronOcr;

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

        // Set the language to Persian
        Ocr.Language = OcrLanguage.Persian;

        // Load input image or PDF file
        using (var Input = new OcrInput(@"images\Persian.png"))
        {
            // Perform OCR to read text from the image
            var Result = Ocr.Read(Input);

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

            // Display the extracted text
            Console.WriteLine(AllText);
        }
    }
}
' Install IronOcr.Languages.Persian package using NuGet Package Manager
' PM> Install-Package IronOcr.Languages.Persian

Imports IronOcr

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

		' Set the language to Persian
		Ocr.Language = OcrLanguage.Persian

		' Load input image or PDF file
		Using Input = New OcrInput("images\Persian.png")
			' Perform OCR to read text from the image
			Dim Result = Ocr.Read(Input)

			' Extract the recognized text
			Dim AllText = Result.Text

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

L'exemple de code ci-dessus montre comment utiliser la bibliothèque IronOCR pour effectuer une reconnaissance optique de caractères (OCR) sur une image persane. Il est indispensable d'avoir installé le pack de langue persane et le chemin d'accès à l'image doit être correctement spécifié. L'opération OCR est effectuée dans une instruction using afin de garantir une gestion appropriée des ressources.