OCR letón en C# y .NET
Other versions of this document:
IronOCR es un componente de software en C# que permite a los programadores de .NET leer texto de imágenes y documentos PDF en 126 idiomas, incluido el letón.
Es una rama avanzada de Tesseract, construida exclusivamente para desarrolladores de .NET y supera regularmente a otros motores de Tesseract tanto en velocidad como en precisión.
Contenido de IronOcr.Languages.Latvian
Este paquete contiene 46 idiomas OCR para .NET:
- Letón
- LetónMejorado
- LetónRápido
Descargar
Paquete de idioma letón [latviešu valoda]
Instalación
Lo primero que necesitas hacer es instalar el paquete OCR letón en tu proyecto .NET.
Install-Package IronOCR.Languages.Latvian
Ejemplo de código
Este ejemplo de código en C# lee texto en letón desde una imagen o un 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 ClassExplicación
- Namespace IronOcr: El ejemplo comienza importando el espacio de nombres
IronOcr, necesario para acceder a las funcionalidades de OCR. - Instancia de IronTesseract: Se crea el objeto
IronTesseract(Ocr) para manejar la lectura de la imagen y la extracción de texto. - Configuración de Idioma: El proceso de OCR se configura para leer texto en letón configurando la propiedad
Ocr.Language. - Objeto OcrInput: Se crea un objeto
OcrInput, haciendo referencia al archivo de imagen que se procesará. - Leyendo la Imagen: El método
Readse llama en la instancia deOcrpara procesar la imagen y extraer texto, almacenado en la variableResult. - Extracción del Resultado: Los resultados del OCR se acceden a través de
Result.Texty se almacenan enAllTextpara uso posterior o visualización. - Salida de Consola: El texto en letón reconocido se imprime en la consola, proporcionando una confirmación visual de la extracción de texto.





