Latin Alphabet OCR in C# and .NET
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 for .NET :
- Alphabet latin
- Alphabet latinBest
- Alphabet latin rapide
Télécharger
Pack de langue alphabet latin [latin]
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
Explication
-
Initialisation d'IronTesseract : Une instance de
IronTesseractest initialisée, qui gérera le traitement OCR. -
Paramètre de langue : La langue OCR est définie sur
LatinAlphabet, qui est l'une des langues disponibles dans le package IronOCR . -
Spécification d'entrée : Un objet
OcrInputest créé, spécifiant le chemin d'accès à l'image ou au PDF à partir duquel le texte sera extrait. -
Exécution OCR : La méthode
Readde l'instanceIronTesseractest appelée pour traiter leOcrInput. Cela renvoie un objetResultcontenant le texte extrait. -
Extraction de texte : La propriété
Textde l'objetResultest utilisée pour accéder au texte reconnu. - 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.

