Galician OCR in C# and .NET
Inne wersje tego dokumentu:
IronOCR to komponent oprogramowania w C#, który pozwala deweloperom .NET na ekstrakcję tekstu z obrazów i dokumentów PDF w 126 językach, w tym po galicyjsku.
Jest to zaawansowana gałąź Tesseract, zaprojektowana specjalnie dla deweloperów .NET, konsekwentnie przewyższająca inne silniki Tesseract pod względem szybkości i dokładności.
Zawartość IronOcr.Languages.Galician
Ten pakiet zawiera 49 języków OCR dla .NET, w tym:
- Galicyjski
- GalicyjskiBest
- GalicyjskiFast
Pobieranie
Galician Language Pack [galego]
Instalacja
Pierwszym krokiem, aby wykorzystać pakiet Galician OCR w swoim projekcie .NET, jest jego instalacja.
Install-Package IronOcr.Languages.Galician
Przyklad kodu
Poniższy przykład kodu w C# pokazuje, jak odczytać tekst galicyjski z obrazu lub dokumentu PDF.
// Include the IronOcr library
using IronOcr;
class Program
{
static void Main()
{
// Instantiate the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Specify the language for OCR as Galician
Ocr.Language = OcrLanguage.Galician;
// Define the input source, here it is an image file
using (var Input = new OcrInput(@"images\Galician.png"))
{
// Perform the OCR process on the input image
var Result = Ocr.Read(Input);
// Retrieve the recognized text from the OCR result
var AllText = Result.Text;
// Output the extracted text to the console
Console.WriteLine(AllText);
}
}
}
// Include the IronOcr library
using IronOcr;
class Program
{
static void Main()
{
// Instantiate the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Specify the language for OCR as Galician
Ocr.Language = OcrLanguage.Galician;
// Define the input source, here it is an image file
using (var Input = new OcrInput(@"images\Galician.png"))
{
// Perform the OCR process on the input image
var Result = Ocr.Read(Input);
// Retrieve the recognized text from the OCR result
var AllText = Result.Text;
// Output the extracted text to the console
Console.WriteLine(AllText);
}
}
}
' Include the IronOcr library
Imports IronOcr
Friend Class Program
Shared Sub Main()
' Instantiate the IronTesseract OCR engine
Dim Ocr = New IronTesseract()
' Specify the language for OCR as Galician
Ocr.Language = OcrLanguage.Galician
' Define the input source, here it is an image file
Using Input = New OcrInput("images\Galician.png")
' Perform the OCR process on the input image
Dim Result = Ocr.Read(Input)
' Retrieve the recognized text from the OCR result
Dim AllText = Result.Text
' Output the extracted text to the console
Console.WriteLine(AllText)
End Using
End Sub
End Class
W powyższym kodzie:
- Używamy klasy IronTesseract do stworzenia obiektu silnika OCR.
- Ustawiamy język OCR na galicyjski, co zapewnia, że silnik OCR dokładnie przetworzy tekst galicyjski.
- Następnie czytamy plik obrazu znajdujący się pod "images\Galician.png" i uzyskujemy rozpoznany tekst.
- Na koniec drukujemy rozpoznany tekst na konsoli.

