Swahili OCR in C# and .NET
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);
}
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
Explicación:
-
Uso del espacio de nombres IronOCR : incluimos el espacio de nombres
IronOcr, que proporciona clases y métodos para operaciones de OCR. -
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. -
Entrada de OCR : La clase
OcrInputse utiliza para especificar el archivo (imagen o PDF) del que queremos extraer texto. -
Lectura de OCR : el método
Readprocesa la entrada y devuelve un objetoOcrResultque contiene el texto reconocido. - 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.

