OCR cingalés 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 en C# que permite a los programadores de .NET leer texto de imágenes y documentos PDF en 126 idiomas, incluyendo Sinhala.

Es una bifurcación avanzada de Tesseract, construida exclusivamente para desarrolladores .NET, y regularmente supera a otros motores Tesseract tanto en velocidad como en precisión.

Contenido de IronOcr.Languages.Sinhala

Este paquete contiene 114 idiomas OCR para .NET:

  • Sinhala
  • SinhalaBest
  • SinhalaFast
  • SinhalaAlphabet
  • SinhalaAlphabetBest
  • SinhalaAlphabetFast

Descargar

Paquete de idioma Sinhala [සංහල]

Instalación

Lo primero que tenemos que hacer es instalar el paquete OCR en Sinhala en tu proyecto .NET.

Install-Package IronOCR.Languages.Sinhala

Ejemplo de código

Este ejemplo de código en C# lee texto en Sinhala de una imagen o documento PDF.

// Import the IronOcr namespace
using IronOcr;

class SinhalaOcrExample
{
    static void Main()
    {
        // Initialize the IronTesseract OCR engine
        var Ocr = new IronTesseract();

        // Set the OCR engine to use the Sinhala language
        Ocr.Language = OcrLanguage.Sinhala;

        // Define the input image or PDF file
        using (var Input = new OcrInput(@"images\Sinhala.png"))
        {
            // Perform OCR on the input
            var Result = Ocr.Read(Input);

            // Retrieve the recognized text
            var AllText = Result.Text;

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

class SinhalaOcrExample
{
    static void Main()
    {
        // Initialize the IronTesseract OCR engine
        var Ocr = new IronTesseract();

        // Set the OCR engine to use the Sinhala language
        Ocr.Language = OcrLanguage.Sinhala;

        // Define the input image or PDF file
        using (var Input = new OcrInput(@"images\Sinhala.png"))
        {
            // Perform OCR on the input
            var Result = Ocr.Read(Input);

            // Retrieve the recognized text
            var AllText = Result.Text;

            // Output the recognized text
            Console.WriteLine(AllText);
        }
    }
}
' Import the IronOcr namespace
Imports IronOcr

Friend Class SinhalaOcrExample
	Shared Sub Main()
		' Initialize the IronTesseract OCR engine
		Dim Ocr = New IronTesseract()

		' Set the OCR engine to use the Sinhala language
		Ocr.Language = OcrLanguage.Sinhala

		' Define the input image or PDF file
		Using Input = New OcrInput("images\Sinhala.png")
			' Perform OCR on the input
			Dim Result = Ocr.Read(Input)

			' Retrieve the recognized text
			Dim AllText = Result.Text

			' Output the recognized text
			Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel

Explicación:

  • IronTesseract: Esta es la clase principal del motor OCR utilizada para el reconocimiento de texto.
  • Language: Especifica el idioma del texto a ser reconocido; en este caso, Sinhala.
  • OcrInput: Representa el archivo de entrada (imagen o PDF) donde se debe realizar el reconocimiento de texto.
  • Read: Ejecuta el proceso de OCR en el archivo de entrada y devuelve el texto reconocido.
  • Result.Text: Contiene el texto reconocido por OCR del archivo de entrada, que puede usarse para procesamiento posterior o visualización.