Sundanese OCR in C# and .NET
Inne wersje tego dokumentu:
IronOCR to komponent oprogramowania C#, umożliwiający programistom .NET odczytywanie tekstu z obrazów i dokumentów PDF w 126 językach, w tym w języku sundajskim.
Jest to zaawansowany fork Tesseracta, zbudowany wyłącznie dla deweloperów .NET i regularnie przewyższający inne silniki Tesseract pod względem szybkości i dokładności.
Zawartość IronOcr.Languages.Sundanese
Pakiet ten zawiera 52 języki OCR dla .NET:
- Sundanese
- SundaneseBest
- SundaneseFast
Pobieranie
Sundanese Language Pack [Basa Sunda]
Instalacja
Pierwszą rzeczą, którą musimy zrobić, to zainstalować nasz pakiet Sundanese OCR do projektu .NET.
Install-Package IronOcr.Languages.Sundanese
Przyklad kodu
Ten przykład kodu C# odczytuje tekst w języku sundajskim z obrazu lub dokumentu PDF.
// Import the IronOcr namespace
using IronOcr;
class Program
{
static void Main()
{
// Create a new instance of the IronTesseract class
var Ocr = new IronTesseract();
// Specify the language the OCR engine should use
Ocr.Language = OcrLanguage.Sundanese;
// Initialize the OCR input with an image file containing Sundanese text
using (var Input = new OcrInput(@"images\Sundanese.png"))
{
// Process the input and get the result
var Result = Ocr.Read(Input);
// Extract all recognized text from the result
var AllText = Result.Text;
// Output the recognized text
System.Console.WriteLine(AllText);
}
}
}
// Import the IronOcr namespace
using IronOcr;
class Program
{
static void Main()
{
// Create a new instance of the IronTesseract class
var Ocr = new IronTesseract();
// Specify the language the OCR engine should use
Ocr.Language = OcrLanguage.Sundanese;
// Initialize the OCR input with an image file containing Sundanese text
using (var Input = new OcrInput(@"images\Sundanese.png"))
{
// Process the input and get the result
var Result = Ocr.Read(Input);
// Extract all recognized text from the result
var AllText = Result.Text;
// Output the recognized text
System.Console.WriteLine(AllText);
}
}
}
' Import the IronOcr namespace
Imports IronOcr
Friend Class Program
Shared Sub Main()
' Create a new instance of the IronTesseract class
Dim Ocr = New IronTesseract()
' Specify the language the OCR engine should use
Ocr.Language = OcrLanguage.Sundanese
' Initialize the OCR input with an image file containing Sundanese text
Using Input = New OcrInput("images\Sundanese.png")
' Process the input and get the result
Dim Result = Ocr.Read(Input)
' Extract all recognized text from the result
Dim AllText = Result.Text
' Output the recognized text
System.Console.WriteLine(AllText)
End Using
End Sub
End Class
Wyjaśnienie
- Najpierw importujemy przestrzeń nazw
IronOcr, aby użyć jej funkcji OCR. - Tworzona jest instancja
IronTesseract, która działa jako nasz główny silnik OCR. - Ustawiamy właściwość
LanguagenaOcrLanguage.Sundanese, aby określić, że silnik powinien oczekiwać tekstu w języku sundajskim. - Tworzymy obiekt
OcrInput, aby określić źródło pliku obrazu dla naszego silnika OCR. - Metoda
Readprzetwarza dane wejściowe i próbuje rozpoznać tekst. - Rozpoznany tekst jest przechowywany w zmiennej
AllTexti następnie drukowany na konsoli.
Ta konfiguracja pozwala na solidne rozpoznawanie tekstu w języku sundajskim z obrazów za pomocą biblioteki IronOCR w środowisku .NET.

