Swahili OCR in C# and .NET

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

Otras versiones de este documento

IronOCR es un componente de software en C# que permite a los desarrolladores en .NET leer texto de imágenes y documentos PDF en 126 idiomas, incluido el suajili. Es una derivación avanzada de Tesseract, construida exclusivamente para desarrolladores de .NET, y supera regularmente a otros motores de Tesseract tanto en velocidad como en precisión.

Contenido de IronOcr.Languages.Swahili

Este paquete contiene 46 idiomas OCR for .NET:

  • Suajili
  • SuajiliMejor
  • SuajiliRápido

Descargar

Paquete de idioma suajili [Kiswahili]

Instalación

Lo primero que tenemos que hacer es instalar nuestro paquete OCR de suajili en tu proyecto .NET.

Install-Package IronOcr.Languages.Swahili

Ejemplo de código

Este ejemplo de código en C# lee texto en suajili de una imagen o documento 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);
}
$vbLabelText   $csharpLabel

Explicación:

  1. Uso del espacio de nombres IronOCR : incluimos el espacio de nombres IronOcr, que proporciona clases y métodos para operaciones de OCR.

  2. Inicializar el motor de OCR : Creamos una instancia de IronTesseract, que es el motor de OCR. Al configurar su idioma en suajili, podrá reconocer texto en suajili.

  3. Entrada de OCR : La clase OcrInput se utiliza para especificar el archivo (imagen o PDF) del que queremos extraer texto.

  4. Lectura de OCR : el método Read procesa la entrada y devuelve un objeto OcrResult que contiene el texto reconocido.

  5. Salida : El texto reconocido se almacena en AllText, que puede usarse según sea necesario. En este ejemplo, se imprime en la consola con fines de demostración.