Sinhala OCR in C# and .NET
Autres versions de ce 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 cinghalais.
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.Langues.Cinghalais
Ce package contient 114 langues OCR for .NET :
- Cinghalais
- SinhalaBest
- SinhalaFast
- Alphabet cinghalais
- Meilleur alphabet cinghalais
- Alphabet cinghalais rapide
Télécharger
Pack de langue cinghalaise [cinghalais]
Installation
La première chose à faire est d'installer le package OCR cinghalais dans votre projet .NET.
Install-Package IronOcr.Languages.Sinhala
Exemple de code
Cet exemple de code C# lit du texte en cinghalais à partir d'une image ou d'un document PDF.
// Import the IronOcr namespace
using IronOcr;
class SinhalaOcrExample
{
static void Main()
{
// Initialize the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Set the OCR engine to use the Sinhala language
Ocr.Language = OcrLanguage.Sinhala;
// Define the input image or PDF file
using (var Input = new OcrInput(@"images\Sinhala.png"))
{
// Perform OCR on the input
var Result = Ocr.Read(Input);
// Retrieve the recognized text
var AllText = Result.Text;
// Output the recognized text
Console.WriteLine(AllText);
}
}
}
// Import the IronOcr namespace
using IronOcr;
class SinhalaOcrExample
{
static void Main()
{
// Initialize the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Set the OCR engine to use the Sinhala language
Ocr.Language = OcrLanguage.Sinhala;
// Define the input image or PDF file
using (var Input = new OcrInput(@"images\Sinhala.png"))
{
// Perform OCR on the input
var Result = Ocr.Read(Input);
// Retrieve the recognized text
var AllText = Result.Text;
// Output the recognized text
Console.WriteLine(AllText);
}
}
}
' Import the IronOcr namespace
Imports IronOcr
Friend Class SinhalaOcrExample
Shared Sub Main()
' Initialize the IronTesseract OCR engine
Dim Ocr = New IronTesseract()
' Set the OCR engine to use the Sinhala language
Ocr.Language = OcrLanguage.Sinhala
' Define the input image or PDF file
Using Input = New OcrInput("images\Sinhala.png")
' Perform OCR on the input
Dim Result = Ocr.Read(Input)
' Retrieve the recognized text
Dim AllText = Result.Text
' Output the recognized text
Console.WriteLine(AllText)
End Using
End Sub
End Class
Explication :
- IronTesseract : Il s'agit de la principale classe de moteur OCR utilisée pour la reconnaissance de texte.
- Langue : Spécifie la langue du texte à reconnaître ; dans ce cas, le cinghalais.
- OcrInput : Représente le fichier d'entrée (image ou PDF) dans lequel la reconnaissance de texte doit être effectuée.
- Lecture : Exécute le processus OCR sur le fichier d'entrée et renvoie le texte reconnu.
- Result.Text : Contient le texte reconnu par OCR à partir du fichier d'entrée, qui peut être utilisé pour un traitement ou un affichage ultérieur.

