Serbian OCR in C# and .NET

This article was translated from English: Does it need improvement?
Translated
View the article in English
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);
        }
    }
}
$vbLabelText   $csharpLabel

Explicação do código:

  • Inicializamos uma nova instância de IronTesseract que é usada para realizar OCR.
  • O idioma do mecanismo de OCR é definido para o Sérvio usando OcrLanguage.Serbian.
  • Carregamos a imagem Serbian.png usando OcrInput que 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 AllText e então impresso no console.