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

O IronOCR é um componente de software C# que permite aos programadores .NET ler texto de imagens e documentos PDF em 126 idiomas, incluindo o vietnamita.

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.Idiomas.Vietnamita

Este pacote contém 132 idiomas de OCR for .NET:

  • Vietnamita
  • Melhor vietnamita
  • Vietnamita Rápido
  • Alfabeto vietnamita
  • Melhor Alfabeto Vietnamita
  • Alfabeto Vietnamita Rápido

Baixar

Pacote de idioma vietnamita [Tiếng Việt]

Instalação

A primeira coisa que precisamos fazer é instalar nosso pacote de OCR vietnamita em seu projeto .NET .

Install-Package IronOcr.Languages.Vietnamese

Exemplo de código

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

// You need to install the IronOcr.Languages.Vietnamese package using the following NuGet command before running this code:
// PM> Install-Package IronOcr.Languages.Vietnamese

using IronOcr;

var Ocr = new IronTesseract();

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

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

    // Extract all recognized text
    var AllText = Result.Text;

    // Example: Output the extracted text to the console
    Console.WriteLine(AllText);
}
// You need to install the IronOcr.Languages.Vietnamese package using the following NuGet command before running this code:
// PM> Install-Package IronOcr.Languages.Vietnamese

using IronOcr;

var Ocr = new IronTesseract();

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

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

    // Extract all recognized text
    var AllText = Result.Text;

    // Example: Output the extracted text to the console
    Console.WriteLine(AllText);
}
$vbLabelText   $csharpLabel

Neste exemplo de código:

  • Criamos uma instância de IronTesseract.
  • Defina o idioma para vietnamita usando Ocr.Language = OcrLanguage.Vietnamese;.
  • Crie um objeto OcrInput com o caminho para a imagem ou PDF.
  • Chame o método Read para realizar OCR e obter o texto extraído.
  • O texto extraído é armazenado em AllText, que pode ser usado conforme necessário, como exibi-lo ou salvá-lo em um arquivo.