Russian OCR in C# and .NET

Other versions of this document:

IronOCR is a C# software component allowing .NET coders to read text from images and PDF documents in 126 languages, including Russian.

It is an advanced fork of Tesseract, built exclusively for the .NET developers and regularly outperforms other Tesseract engines for both speed and accuracy.

Contents of IronOcr.Languages.Russian

This package contains 46 OCR languages for .NET:

  • Russian
  • RussianBest
  • RussianFast

Download

Russian Language Pack [русский язык]

Installation

The first thing we have to do is install our Russian OCR package to your .NET project.

Install-Package IronOCR.Languages.Russian

Code Example

This C# code example reads Russian text from an Image or PDF document.

// 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);
        }
    }
}
' Import the IronOCR namespace
Imports IronOcr

Friend Class Program
	Shared Sub Main()
		' Initialize IronTesseract, an OCR object
		Dim Ocr = New IronTesseract()

		' Set the OCR language to Russian
		Ocr.Language = OcrLanguage.Russian

		' Create an OCR input for the Russian image
		Using Input = New OcrInput("images\Russian.png")
			' Perform OCR on the input image
			Dim Result = Ocr.Read(Input)

			' Extract all the recognized text
			Dim AllText = Result.Text

			' Output the recognized text
			System.Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel
  • The above code imports the necessary IronOCR library and initializes IronTesseract, a class used to perform OCR tasks.
  • It sets the language for OCR to Russian using Ocr.Language = OcrLanguage.Russian.
  • It then opens the specified image file Russian.png using the OcrInput class.
  • The Read method of the Ocr object is used to process the image and recognize text,
  • Finally, it extracts the recognized text from the Result.Text and outputs it.