Han Simplified Alphabet OCR in C# and .NET
O IronOCR é um componente de software C# que permite que programadores .NET leiam texto de imagens e documentos PDF em 126 idiomas, incluindo o Alfabeto Han Simplificado.
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údos de IronOcr.Languages.Han
Este pacote contém 400 idiomas OCR for .NET:
- Alfabeto Simplificado Han
- Alfabeto Simplificado HanBest
- Alfabeto Simplificado HanFast
- Alfabeto vertical simplificado Han
- Alfabeto vertical simplificado HanBest
- Alfabeto vertical simplificado HanFast
- Alfabeto Tradicional Han
- Alfabeto Tradicional HanBest
- Alfabeto Tradicional HanFast
- Alfabeto vertical tradicional Han
- Alfabeto vertical tradicional HanBest
- Alfabeto vertical tradicional rápido
Baixar
Pacote de Idioma do Alfabeto Han Simplificado [Samhan]
- Download as [Zip](javascript:window.open("/csharp/ocr/packages/language-packs/Han.ocrdata.zip")
- Instale com NuGet
Instalação
A primeira coisa que precisamos fazer é instalar nosso pacote OCR do Alfabeto Han Simplificado no seu projeto .NET.
Execute o seguinte comando no Console do Gerenciador de Pacotes:
Install-Package IronOcr.Languages.Han
Exemplo de código
Este exemplo de código C# lê texto do Alfabeto Han Simplificado de uma imagem ou documento PDF.
// Reference the IronOcr library
using IronOcr;
class Program
{
static void Main()
{
// Create an IronTesseract OCR engine
var Ocr = new IronTesseract();
// Load the Han language for OCR processing
Ocr.Language = OcrLanguage.Han;
// Using a 'using' statement for resource management
using (var Input = new OcrInput(@"images\Han.png"))
{
// Process the image to extract text
var Result = Ocr.Read(Input);
// Retrieve and display the extracted text
string AllText = Result.Text;
System.Console.WriteLine(AllText);
}
}
}
// Reference the IronOcr library
using IronOcr;
class Program
{
static void Main()
{
// Create an IronTesseract OCR engine
var Ocr = new IronTesseract();
// Load the Han language for OCR processing
Ocr.Language = OcrLanguage.Han;
// Using a 'using' statement for resource management
using (var Input = new OcrInput(@"images\Han.png"))
{
// Process the image to extract text
var Result = Ocr.Read(Input);
// Retrieve and display the extracted text
string AllText = Result.Text;
System.Console.WriteLine(AllText);
}
}
}
' Reference the IronOcr library
Imports IronOcr
Friend Class Program
Shared Sub Main()
' Create an IronTesseract OCR engine
Dim Ocr = New IronTesseract()
' Load the Han language for OCR processing
Ocr.Language = OcrLanguage.Han
' Using a 'using' statement for resource management
Using Input = New OcrInput("images\Han.png")
' Process the image to extract text
Dim Result = Ocr.Read(Input)
' Retrieve and display the extracted text
Dim AllText As String = Result.Text
System.Console.WriteLine(AllText)
End Using
End Sub
End Class
Explicação
Começamos por utilizar a biblioteca IronOCR para aproveitar suas funcionalidades de OCR.
- Uma instância de
IronTesseracté criada para processar os documentos de imagem/PDF. - O idioma para o processo de OCR está definido como
HanusandoOcr.Language. - Uma imagem é carregada usando
OcrInpute processada chamandoOcr.Read(). - O resultado do processo de OCR é armazenado em
Result.Text, que contém o texto extraído do documento. - Finalmente imprimimos o texto no console.
Certifique-se de ter as diretivas using adequadas e gerencie os recursos de forma eficiente com as instruções using, especialmente ao lidar com recursos não gerenciados, como fluxos de arquivos.

