Reconocimiento óptico de caracteres (OCR) suajili en C# y .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 para .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);
}
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

Explicación:

  1. Usar el espacio de nombres de IronOcr: Incluimos el espacio de nombres IronOcr, que proporciona clases y métodos para operaciones OCR.

  2. Inicializar el motor OCR: Creamos una instancia de IronTesseract, que es el motor OCR. Configurar su idioma a suajili le permite reconocer texto en suajili.

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

  4. Lectura 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 se puede usar según se necesite. En este ejemplo, se imprime en la consola con fines de demostración.