Galician 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:

IronOCR é um componente de software C# que permite aos desenvolvedores .NET extrair texto de imagens e documentos PDF em 126 idiomas, incluindo o galego.

É um fork avançado do Tesseract, projetado especificamente para desenvolvedores .NET, e supera consistentemente outros motores Tesseract tanto em velocidade quanto em precisão.

Conteúdos de IronOcr.Languages.Galician

Este pacote contém 49 idiomas OCR for .NET, incluindo:

  • Galego
  • GalicianBest
  • GalicianFast

Baixar

Pacote de Idioma Galego [galego]

Instalação

A primeira etapa para utilizar o pacote OCR Galego em seu projeto .NET é instalá-lo.

Install-Package IronOcr.Languages.Galician

Exemplo de código

O exemplo de código C# a seguir demonstra como ler texto em galego de uma imagem ou documento PDF.

// Include the IronOcr library
using IronOcr;

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

        // Specify the language for OCR as Galician
        Ocr.Language = OcrLanguage.Galician;

        // Define the input source, here it is an image file
        using (var Input = new OcrInput(@"images\Galician.png"))
        {
            // Perform the OCR process on the input image
            var Result = Ocr.Read(Input);

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

            // Output the extracted text to the console
            Console.WriteLine(AllText);
        }
    }
}
// Include the IronOcr library
using IronOcr;

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

        // Specify the language for OCR as Galician
        Ocr.Language = OcrLanguage.Galician;

        // Define the input source, here it is an image file
        using (var Input = new OcrInput(@"images\Galician.png"))
        {
            // Perform the OCR process on the input image
            var Result = Ocr.Read(Input);

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

            // Output the extracted text to the console
            Console.WriteLine(AllText);
        }
    }
}
' Include the IronOcr library
Imports IronOcr

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

		' Specify the language for OCR as Galician
		Ocr.Language = OcrLanguage.Galician

		' Define the input source, here it is an image file
		Using Input = New OcrInput("images\Galician.png")
			' Perform the OCR process on the input image
			Dim Result = Ocr.Read(Input)

			' Retrieve the recognized text from the OCR result
			Dim AllText = Result.Text

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

No código acima:

  • Estamos usando a classe IronTesseract para criar um objeto de motor OCR.
  • Definimos o idioma OCR para Galego, o que garante que o motor OCR processe texto galego com precisão.
  • Em seguida, lemos o arquivo de imagem localizado em "images\Galician.png" e obtemos o texto reconhecido.
  • Finalmente, imprimimos o texto reconhecido no console.