Italian OCR in C# and .NET
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:
- Italiano
- ItalianBest
- ItalianFast
- ItalianOld
- ItalianOldBest
- ItalianOldFast
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
Explicação:
- Usando o IronOCR: A biblioteca
IronOcré incluída para utilizar suas capacidades de OCR. - Criando uma Instância do IronTesseract:
IronTesseracté uma classe principal usada para o processamento OCR. - Definindo o Idioma: O OCR é configurado para processar o idioma italiano usando
Ocr.Language = OcrLanguage.Italian. - Lendo a Entrada: Um objeto
OcrInputé criado para especificar o arquivo de imagem. - Executando OCR:
Ocr.Read(Input)executa o processo OCR na imagem de entrada e retorna o resultado em texto. - Saída: O texto resultante é armazenado em
AllTexte exibido no console.
Certifique-se de que o caminho do arquivo images\Italian.png está correto e que o arquivo existe para que o exemplo funcione corretamente.

