OCR swahili en C# et .NET

This article was translated from English: Does it need improvement?
Translated
View the article in English

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 swahili. 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.Swahili

Ce package contient 46 langues OCR pour .NET :

  • Swahili
  • SwahiliBest
  • SwahiliFast

Télécharger

Pack de langue swahili [Kiswahili]

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

Installation

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

Install-Package IronOCR.Languages.Swahili

Exemple de code

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

using IronOcr;

var Ocr = new IronTesseract();

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

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

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

    // Output the recognized text to the console (optional)
    Console.WriteLine(AllText);
}
using IronOcr;

var Ocr = new IronTesseract();

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

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

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

    // Output the recognized text to the console (optional)
    Console.WriteLine(AllText);
}
Imports IronOcr

Private Ocr = New IronTesseract()

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

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

	' Retrieve the recognized text
	Dim AllText = Result.Text

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

Explication :

  1. Utilisation de l'espace de noms IronOcr : Nous incluons l'espace de noms IronOcr , qui fournit des classes et des méthodes pour les opérations OCR.

  2. Initialisation du moteur OCR : Nous créons une instance d' IronTesseract , qui est le moteur OCR. En définissant sa langue sur le swahili, nous lui permettons de reconnaître le texte swahili.

  3. Entrée OCR : La classe OcrInput est utilisée pour spécifier le fichier (image ou PDF) à partir duquel nous souhaitons extraire du texte.

  4. Lecture OCR : La méthode Read traite l'entrée et renvoie un objet OcrResult contenant le texte reconnu.

  5. Sortie : Le texte reconnu est stocké dans AllText , qui peut être utilisé selon les besoins. Dans cet exemple, le résultat est affiché sur la console à des fins de démonstration.