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
- LettischBest
- LettischFast
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 Namespaces
IronOcr, der für den Zugriff auf OCR-Funktionen erforderlich ist. - IronTesseract-Instanz: Das
IronTesseract-Objekt (Ocr) wird erstellt, um das Einlesen von Bildern und die Textextraktion zu übernehmen. - Sprachkonfiguration: Der OCR-Prozess ist durch die Einstellung der Eigenschaft
Ocr.Languagefür das Lesen von lettischem Text konfiguriert. - OcrInput-Objekt: Es wird ein
OcrInput-Objekt erstellt, das auf die zu verarbeitende Bilddatei verweist. - Bild lesen: Die Methode
Readwird für die InstanzOcraufgerufen, um das Bild zu verarbeiten und Text zu extrahieren, der in der VariablenResultgespeichert wird. - Ergebnisausgabe: Auf die OCR-Ergebnisse wird über
Result.Textzugegriffen und sie werden 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.

