Russian 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 russo.

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.Russo

Este pacote contém 46 linguagens de OCR for .NET:

  • Russo
  • RussianBest
  • RussoRápido

Baixar

Pacote de idioma russo [русский язык]

Instalação

A primeira coisa que precisamos fazer é instalar nosso pacote de OCR em russo no seu projeto .NET.

Install-Package IronOcr.Languages.Russian

Exemplo de código

Este exemplo de código C# lê texto em russo de uma imagem ou documento PDF.

// Import the IronOCR namespace
using IronOcr;

class Program
{
    static void Main()
    {
        // Initialize IronTesseract, an OCR object
        var Ocr = new IronTesseract();

        // Set the OCR language to Russian
        Ocr.Language = OcrLanguage.Russian;

        // Create an OCR input for the Russian image
        using (var Input = new OcrInput(@"images\Russian.png"))
        {
            // Perform OCR on the input image
            var Result = Ocr.Read(Input);

            // Extract all the recognized text
            var AllText = Result.Text;

            // Output the recognized text
            System.Console.WriteLine(AllText);
        }
    }
}
// Import the IronOCR namespace
using IronOcr;

class Program
{
    static void Main()
    {
        // Initialize IronTesseract, an OCR object
        var Ocr = new IronTesseract();

        // Set the OCR language to Russian
        Ocr.Language = OcrLanguage.Russian;

        // Create an OCR input for the Russian image
        using (var Input = new OcrInput(@"images\Russian.png"))
        {
            // Perform OCR on the input image
            var Result = Ocr.Read(Input);

            // Extract all the recognized text
            var AllText = Result.Text;

            // Output the recognized text
            System.Console.WriteLine(AllText);
        }
    }
}
$vbLabelText   $csharpLabel
  • O código acima importa a biblioteca IronOCR necessária e inicializa IronTesseract, uma classe usada para realizar tarefas de OCR.
  • Ele define o idioma para OCR como russo usando Ocr.Language = OcrLanguage.Russian.
  • Em seguida, ele abre o arquivo de imagem especificado Russian.png usando a classe OcrInput.
  • O método Read do objeto Ocr é usado para processar a imagem e reconhecer o texto,
  • Finalmente, ele extrai o texto reconhecido do Result.Text e o exibe.