Latvian OCR in C# and .NET
Outras versões deste documento:
IronOCR é um componente de software C# que permite aos programadores .NET ler texto de imagens e documentos PDF em 126 idiomas, incluindo o letão.
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 de IronOcr.Languages.Latvian
Este pacote contém 46 linguagens de OCR for .NET:
- Letão
- LatvianBest
- LatvianFast
Baixar
Pacote de Idioma Letão [latviešu valoda]
Instalação
A primeira coisa que você precisa fazer é instalar o pacote OCR Latvian no seu projeto .NET.
Install-Package IronOcr.Languages.Latvian
Exemplo de código
Este exemplo de código C# lê texto letão de uma imagem ou documento PDF.
using IronOcr;
class LatvianOCRExample
{
static void Main()
{
// Create an instance of IronTesseract for OCR
var Ocr = new IronTesseract();
// Set the OCR language to Latvian
Ocr.Language = OcrLanguage.Latvian;
// Define the input image file path
using (var Input = new OcrInput(@"images\Latvian.png"))
{
// Perform OCR on the input image
var Result = Ocr.Read(Input);
// Extract all recognized text from the OCR result
var AllText = Result.Text;
// Output the recognized text to the console
Console.WriteLine(AllText);
}
}
}
using IronOcr;
class LatvianOCRExample
{
static void Main()
{
// Create an instance of IronTesseract for OCR
var Ocr = new IronTesseract();
// Set the OCR language to Latvian
Ocr.Language = OcrLanguage.Latvian;
// Define the input image file path
using (var Input = new OcrInput(@"images\Latvian.png"))
{
// Perform OCR on the input image
var Result = Ocr.Read(Input);
// Extract all recognized text from the OCR result
var AllText = Result.Text;
// Output the recognized text to the console
Console.WriteLine(AllText);
}
}
}
Imports IronOcr
Friend Class LatvianOCRExample
Shared Sub Main()
' Create an instance of IronTesseract for OCR
Dim Ocr = New IronTesseract()
' Set the OCR language to Latvian
Ocr.Language = OcrLanguage.Latvian
' Define the input image file path
Using Input = New OcrInput("images\Latvian.png")
' Perform OCR on the input image
Dim Result = Ocr.Read(Input)
' Extract all recognized text from the OCR result
Dim AllText = Result.Text
' Output the recognized text to the console
Console.WriteLine(AllText)
End Using
End Sub
End Class
Explicação
- IronOcr Namespace: O exemplo começa importando o namespace
IronOcr, necessário para acessar funcionalidades de OCR. - IronTesseract Instance: O objeto
IronTesseract(Ocr) é criado para lidar com a leitura de imagem e extração de texto. - Language Configuration: O processo de OCR é configurado para ler texto em letão ajustando a propriedade
Ocr.Language. - OcrInput Object: Um objeto
OcrInputé criado, referenciando o arquivo de imagem a ser processado. - Reading the Image: O método
Readé chamado na instânciaOcrpara processar a imagem e extrair texto, armazenado na variávelResult. - Result Extraction: Os resultados de OCR são acessados via
Result.Texte armazenados emAllTextpara uso ou exibição posterior. - Saída no Console: O texto letão reconhecido é impresso no console, fornecendo uma confirmação visual da extração de texto.

