Latvian OCR in C# and .NET
Andere Versionen dieses Dokuments:
IronOCR ist eine C# Softwarekomponente, die es .NET-Entwicklern ermöglicht, Text aus Bildern und PDF-Dokumenten in 126 Sprachen, einschließlich Lettisch, zu lesen.
Es ist eine erweiterte Abspaltung von Tesseract, die exklusiv for .NET-Entwickler entwickelt wurde und regelmäßig andere Tesseract-Engines sowohl in Bezug auf Geschwindigkeit als auch Genauigkeit übertrifft.
Inhalte von IronOcr.Languages.Latvian
Dieses Paket enthält 46 OCR-Sprachen for .NET:
- Lettisch
- LatvianBest
- LatvianFast
Download
Lettisches Sprachpaket [latviešu valoda]
Installation
Das Erste, was Sie tun müssen, ist, das Lettische OCR-Paket in Ihr .NET-Projekt zu installieren.
Install-Package IronOcr.Languages.Latvian
Beispielcode
Dieses C#-Codebeispiel liest lettischen Text aus einem Bild oder PDF-Dokument.
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
Erklärung
- IronOCR Namespace: Das Beispiel beginnt mit dem Import des Namespace
IronOcr, der für den Zugriff auf OCR-Funktionen erforderlich ist. - IronTesseract-Instanz: Das Objekt
IronTesseract(Ocr) wird erstellt, um das Lesen von Bildern und die Extraktion von Text zu handhaben. - Sprachkonfiguration: Der OCR-Prozess ist so konfiguriert, dass er lettischen Text liest, indem die Eigenschaft
Ocr.Languagegesetzt wird. - OcrInput-Objekt: Es wird ein
OcrInput-Objekt erstellt, das auf die zu verarbeitende Bilddatei verweist. - Lesen des Bildes: Die Methode
Readwird auf der InstanzOcraufgerufen, um das Bild zu verarbeiten und den in der VariableResultgespeicherten Text zu extrahieren. - Ergebnisextraktion: Die OCR-Ergebnisse werden über
Result.Textabgerufen und inAllTextzur weiteren Verwendung oder Anzeige gespeichert. - Konsole Ausgabe: Der erkannte lettische Text wird in der Konsole ausgegeben, um eine visuelle Bestätigung der Textextraktion zu bieten.

