Italian 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# permitindo que programadores .NET leiam texto de imagens e documentos PDF em 126 idiomas, incluindo o Italiano.

Trata-se de uma versão avançada do Tesseract, criada exclusivamente para desenvolvedores .NET e que supera regularmente outros mecanismos do Tesseract em termos de velocidade e precisão.

Conteúdo do IronOcr.Languages.Italian

Este pacote contém 6 modos de idioma OCR for .NET:

  • Italian
  • ItalianoMelhor
  • ItalianFast
  • Italiano Antigo
  • ItalianoAntigoMelhor
  • ItalianoVelhoRápido

Baixar

Italian Language Pack [italiano]

Instalação

A primeira coisa que precisamos fazer é instalar o pacote OCR Italiano no seu projeto .NET.

Install-Package IronOcr.Languages.Italian

Exemplo de código

Este exemplo de código C# lê texto em italiano de uma imagem ou documento PDF.

// Include IronOcr library
using IronOcr;

class Program
{
    static void Main()
    {
        // Create a new instance of the IronTesseract class
        var Ocr = new IronTesseract();

        // Set the OCR language to Italian
        Ocr.Language = OcrLanguage.Italian;

        // Read text from an image file
        using (var Input = new OcrInput(@"images\Italian.png"))
        {
            // Perform OCR to get the text content from the image
            var Result = Ocr.Read(Input);

            // Get and print all the recognized text
            var AllText = Result.Text;
            Console.WriteLine(AllText);
        }
    }
}
// Include IronOcr library
using IronOcr;

class Program
{
    static void Main()
    {
        // Create a new instance of the IronTesseract class
        var Ocr = new IronTesseract();

        // Set the OCR language to Italian
        Ocr.Language = OcrLanguage.Italian;

        // Read text from an image file
        using (var Input = new OcrInput(@"images\Italian.png"))
        {
            // Perform OCR to get the text content from the image
            var Result = Ocr.Read(Input);

            // Get and print all the recognized text
            var AllText = Result.Text;
            Console.WriteLine(AllText);
        }
    }
}
' Include IronOcr library
Imports IronOcr

Friend Class Program
	Shared Sub Main()
		' Create a new instance of the IronTesseract class
		Dim Ocr = New IronTesseract()

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

		' Read text from an image file
		Using Input = New OcrInput("images\Italian.png")
			' Perform OCR to get the text content from the image
			Dim Result = Ocr.Read(Input)

			' Get and print all the recognized text
			Dim AllText = Result.Text
			Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel

Explicação:

  1. Usando o IronOCR : A biblioteca IronOcr está incluída para utilizar seus recursos de OCR.
  2. Criando uma instância do IronTesseract : IronTesseract é uma classe principal usada para processamento de OCR.
  3. Configuração do idioma : O OCR está configurado para processar o idioma italiano usando Ocr.Language = OcrLanguage.Italian.
  4. Leitura da entrada : Um objeto OcrInput é criado para especificar o arquivo de imagem.
  5. Executando OCR : Ocr.Read(Input) executa o processo de OCR na imagem de entrada e retorna o resultado do texto.
  6. Saída : O texto resultante é armazenado em AllText e exibido no console.

Certifique-se de que o caminho do arquivo images\Italian.png esteja correto e que o arquivo exista para que o exemplo funcione corretamente.