Serbian 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 Serbian. It is an advanced fork of Tesseract, built exclusively for .NET developers and regularly outperforms other Tesseract engines for both speed and accuracy.

Contents of IronOcr.Languages.Serbian

This package contains 105 OCR languages for .NET:

  • Serbian
  • SerbianBest
  • SerbianFast
  • SerbianLatin
  • SerbianLatinBest
  • SerbianLatinFast

Download

Serbian Language Pack [српски језик]

Installation

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

Install-Package IronOcr.Languages.Serbian

Code Example

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

// 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
$vbLabelText   $csharpLabel

Explanation of the code:

  • We initialize a new instance of IronTesseract which is used to perform OCR.
  • The language of the OCR engine is set to Serbian using OcrLanguage.Serbian.
  • We load the image Serbian.png using OcrInput which reads the file from the specified path.
  • The Read function is called on the OCR object to process the image and extract text.
  • The extracted text from the image is stored in the variable AllText and then printed to the console.