OCR serbio en C# y .NET

This article was translated from English: Does it need improvement?
Translated
View the article in English
Other versions of this document:

IronOCR es un componente de software C# que permite a los programadores de .NET leer texto de imágenes y documentos PDF en 126 idiomas, incluido el serbio. Es una rama avanzada de Tesseract, construida exclusivamente para desarrolladores de .NET y supera regularmente a otros motores de Tesseract tanto en velocidad como en precisión.

Contenido de IronOcr.Languages.Serbian

Este paquete contiene 105 idiomas OCR para .NET:

  • Serbio
  • SerbioBest
  • SerbioFast
  • SerbioLatin
  • SerbioLatinBest
  • SerbioLatinFast

Descargar

Paquete de idioma serbio [српски језик]

Instalación

Lo primero que tenemos que hacer es instalar nuestro paquete OCR serbio en tu proyecto .NET.

Install-Package IronOcr.Languages.Serbian

Ejemplo de código

Este ejemplo de código C# lee texto serbio de una imagen o 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
$vbLabelText   $csharpLabel

Explicación del código:

  • Inicializamos una nueva instancia de IronTesseract que se utiliza para realizar OCR.
  • El idioma del motor OCR se establece en serbio usando OcrLanguage.Serbian.
  • Cargamos la imagen Serbian.png usando OcrInput que lee el archivo desde la ruta especificada.
  • La función Read se llama en el objeto OCR para procesar la imagen y extraer texto.
  • El texto extraído de la imagen se almacena en la variable AllText y luego se imprime en la consola.