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

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

Ce package contient 46 langues OCR pour .NET :

  • Russe
  • RussianBest
  • RussianFast

Télécharger

Pack de langue russe

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

Installation

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

Install-Package IronOCR.Languages.Russian

Exemple de code

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

// Import the IronOCR namespace
using IronOcr;

class Program
{
    static void Main()
    {
        // Initialize IronTesseract, an OCR object
        var Ocr = new IronTesseract();

        // Set the OCR language to Russian
        Ocr.Language = OcrLanguage.Russian;

        // Create an OCR input for the Russian image
        using (var Input = new OcrInput(@"images\Russian.png"))
        {
            // Perform OCR on the input image
            var Result = Ocr.Read(Input);

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

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

class Program
{
    static void Main()
    {
        // Initialize IronTesseract, an OCR object
        var Ocr = new IronTesseract();

        // Set the OCR language to Russian
        Ocr.Language = OcrLanguage.Russian;

        // Create an OCR input for the Russian image
        using (var Input = new OcrInput(@"images\Russian.png"))
        {
            // Perform OCR on the input image
            var Result = Ocr.Read(Input);

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

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

Friend Class Program
	Shared Sub Main()
		' Initialize IronTesseract, an OCR object
		Dim Ocr = New IronTesseract()

		' Set the OCR language to Russian
		Ocr.Language = OcrLanguage.Russian

		' Create an OCR input for the Russian image
		Using Input = New OcrInput("images\Russian.png")
			' Perform OCR on the input image
			Dim Result = Ocr.Read(Input)

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

			' Output the recognized text
			System.Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel
  • Le code ci-dessus importe la bibliothèque IronOCR nécessaire et initialise IronTesseract , une classe utilisée pour effectuer des tâches OCR.
  • Il définit la langue de l'OCR sur le russe en utilisant Ocr.Language = OcrLanguage.Russian .
  • Il ouvre ensuite le fichier image spécifié Russian.png en utilisant la classe OcrInput .
  • La méthode Read de l'objet Ocr est utilisée pour traiter l'image et reconnaître le texte. Enfin, il extrait le texte reconnu de Result.Text et l'affiche.