OCR de l'alphabet latin 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, y compris l'alphabet latin.

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

Ce package contient 64 langues OCR pour .NET :

  • Alphabet latin
  • Alphabet latinBest
  • Alphabet latin rapide

Télécharger

Pack de langue alphabet latin [latin]

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

Installation

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

Install-Package IronOCR.Languages.LatinAlphabet

Exemple de code

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

// Install the IronOCR.languages.LatinAlphabet package first
using IronOcr;

var Ocr = new IronTesseract(); // Initialize IronTesseract instance

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

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

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

    // Output the recognized text
    Console.WriteLine(AllText);
}
// Install the IronOCR.languages.LatinAlphabet package first
using IronOcr;

var Ocr = new IronTesseract(); // Initialize IronTesseract instance

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

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

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

    // Output the recognized text
    Console.WriteLine(AllText);
}
' Install the IronOCR.languages.LatinAlphabet package first
Imports IronOcr

Private Ocr = New IronTesseract() ' Initialize IronTesseract instance

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

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

	' Extract the recognized text
	Dim AllText = Result.Text

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

Explication

  1. Initialisation d'IronTesseract : Une instance d' IronTesseract est initialisée, qui gérera le traitement OCR.

  2. Paramètre de langue : La langue de l'OCR est définie sur LatinAlphabet , qui est l'une des langues disponibles dans le package IronOCR.

  3. Spécification d'entrée : Un objet OcrInput est créé, spécifiant le chemin d'accès à l'image ou au PDF à partir duquel le texte sera extrait.

  4. Exécution OCR : La méthode Read de l'instance IronTesseract est appelée pour traiter l' OcrInput . Cette fonction renvoie un objet Result contenant le texte extrait.

  5. Extraction de texte : La propriété Text de l'objet Result est utilisée pour accéder au texte reconnu.

  6. Sortie : Le texte reconnu est imprimé sur la console pour vérification.

Assurez-vous que le chemin d'accès au fichier dans OcrInput pointe correctement vers votre fichier image ou PDF afin d'éviter les exceptions de fichier introuvable.