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 für .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 Importieren des
IronOcr-Namespace, der für den Zugriff auf OCR-Funktionalitäten notwendig ist. - IronTesseract-Instanz: Das
IronTesseract-Objekt (Ocr) wird erstellt, um das Lesen von Bildern und die Textextraktion zu handhaben. - Sprachkonfiguration: Der OCR-Prozess wird konfiguriert, um lettischen Text zu lesen, indem die
Ocr.Language-Eigenschaft gesetzt wird. - OcrInput-Objekt: Ein
OcrInput-Objekt wird erstellt, das sich auf die zu verarbeitende Bilddatei bezieht. - Bildlesen: Die
Read-Methode wird auf derOcr-Instanz aufgerufen, um das Bild zu verarbeiten und Text zu extrahieren, der in derResult-Variablen gespeichert wird. - Ergebnisauszug: 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.

