Swahili OCR in C# and .NET
Outras versões deste documento
O IronOCR é um componente de software C# que permite aos programadores .NET ler texto de imagens e documentos PDF em 126 idiomas, incluindo o suaíli. Trata-se de uma versão avançada do Tesseract, criada exclusivamente para desenvolvedores .NET , e que supera regularmente outros mecanismos do Tesseract tanto em velocidade quanto em precisão.
Conteúdo de IronOcr.Languages.Swahili
Este pacote contém 46 linguagens de OCR for .NET:
- Suaíli
- SuaíliMelhor
- SuaíliFast
Baixar
Pacote de idioma suaíli [kiswahili]
Instalação
A primeira coisa que precisamos fazer é instalar nosso pacote de OCR para suaíli em seu projeto .NET.
Install-Package IronOcr.Languages.Swahili
Exemplo de código
Este exemplo de código C# lê texto em suaíli de uma imagem ou 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
Explicação:
-
Usando o Namespace IronOcr: Incluímos o
IronOcrnamespace, que fornece classes e métodos para operações de OCR. -
Inicializar Motor OCR: Criamos uma instância de
IronTesseract, que é o motor OCR. Definir seu idioma para suaíli permite que ele reconheça texto em suaíli. -
Entrada OCR: A classe
OcrInputé usada para especificar o arquivo (imagem ou PDF) do qual queremos extrair o texto. -
Leitura OCR: O método
Readprocessa a entrada e retorna um objetoOcrResultcontendo o texto reconhecido. - Saída: O texto reconhecido é armazenado em
AllText, que pode ser usado conforme necessário. Neste exemplo, a mensagem é impressa no console para fins de demonstração.

