Serbian OCR in C# and .NET
Outras versões deste documento:
O IronOCR é um componente de software em C# que permite aos programadores .NET ler texto de imagens e documentos PDF em 126 idiomas, incluindo o sérvio. Trata-se de uma versão avançada do Tesseract, criada exclusivamente para desenvolvedores .NET e que supera regularmente outros mecanismos do Tesseract em termos de velocidade e precisão.
Conteúdo de IronOcr.Idiomas.Sérvio
Este pacote contém 105 linguagens de OCR for .NET:
- Sérvio
- SérvioBest
- SérvioFast
- Sérvio Latim
- Sérvio LatimBest
- SérvioLatinoRápido
Baixar
Pacote de idioma sérvio [српски језик]
Instalação
A primeira coisa que precisamos fazer é instalar nosso pacote de OCR sérvio em seu projeto .NET.
Install-Package IronOcr.Languages.Serbian
Exemplo de código
Este exemplo de código C# lê texto em sérvio a partir de uma imagem ou documento PDF.
// Ensure all necessary namespaces are imported
using IronOcr;
class Program
{
static void Main()
{
// Create a new instance of IronTesseract
var Ocr = new IronTesseract();
// Set the language to Serbian
Ocr.Language = OcrLanguage.Serbian;
// Use a using statement to ensure resources are disposed properly
using (var Input = new OcrInput(@"images\Serbian.png"))
{
// Perform OCR and store the result
var Result = Ocr.Read(Input);
// Extract all text from the OCR result
var AllText = Result.Text;
// Output the resulting text
Console.WriteLine(AllText);
}
}
}
// Ensure all necessary namespaces are imported
using IronOcr;
class Program
{
static void Main()
{
// Create a new instance of IronTesseract
var Ocr = new IronTesseract();
// Set the language to Serbian
Ocr.Language = OcrLanguage.Serbian;
// Use a using statement to ensure resources are disposed properly
using (var Input = new OcrInput(@"images\Serbian.png"))
{
// Perform OCR and store the result
var Result = Ocr.Read(Input);
// Extract all text from the OCR result
var AllText = Result.Text;
// Output the resulting text
Console.WriteLine(AllText);
}
}
}
' Ensure all necessary namespaces are imported
Imports IronOcr
Friend Class Program
Shared Sub Main()
' Create a new instance of IronTesseract
Dim Ocr = New IronTesseract()
' Set the language to Serbian
Ocr.Language = OcrLanguage.Serbian
' Use a using statement to ensure resources are disposed properly
Using Input = New OcrInput("images\Serbian.png")
' Perform OCR and store the result
Dim Result = Ocr.Read(Input)
' Extract all text from the OCR result
Dim AllText = Result.Text
' Output the resulting text
Console.WriteLine(AllText)
End Using
End Sub
End Class
Explicação do código:
- Inicializamos uma nova instância de
IronTesseractque é usada para realizar OCR. - O idioma do mecanismo de OCR é definido para o Sérvio usando
OcrLanguage.Serbian. - Carregamos a imagem
Serbian.pngusandoOcrInputque lê o arquivo do caminho especificado. - A função
Readé chamada no objeto OCR para processar a imagem e extrair o texto. - O texto extraído da imagem é armazenado na variável
AllTexte então impresso no console.

