Czech OCR in C# and .NET
Inne wersje tego dokumentu:
IronOCR to komponent oprogramowania C#, który umożliwia programistom .NET odczytywanie tekstu z obrazów i dokumentów PDF w 126 językach, w tym po czesku.
Jest to zaawansowany fork Tesseract, stworzony wyłącznie dla programistów .NET i regularnie przewyższa inne silniki Tesseract zarówno pod względem szybkości, jak i dokładności.
Zawartość IronOcr.Languages.Czech
Ten pakiet zawiera 40 języków OCR dla .NET:
- Czech
- CzechBest
- CzechFast
Pobieranie
Czech Language Pack [čeština]
Instalacja
Pierwszą rzeczą, którą musimy zrobić, jest zainstalowanie naszego pakietu OCR Czech do twojego projektu .NET.
Install-Package IronOcr.Languages.Czech
Przyklad kodu
Ten przykład kodu C# odczytuje czeski tekst z obrazu lub dokumentu PDF.
// Import the IronOcr namespace
using IronOcr;
class Program
{
static void Main()
{
// Create a new IronTesseract instance
var Ocr = new IronTesseract();
// Set the OCR language to Czech
Ocr.Language = OcrLanguage.Czech;
// Define the input image or PDF and perform OCR
using (var Input = new OcrInput(@"images\Czech.png"))
{
// Read the input and perform OCR
var Result = Ocr.Read(Input);
// Extract all recognized text
var AllText = Result.Text;
// Output the recognized text to the console
Console.WriteLine(AllText);
}
}
}
// Import the IronOcr namespace
using IronOcr;
class Program
{
static void Main()
{
// Create a new IronTesseract instance
var Ocr = new IronTesseract();
// Set the OCR language to Czech
Ocr.Language = OcrLanguage.Czech;
// Define the input image or PDF and perform OCR
using (var Input = new OcrInput(@"images\Czech.png"))
{
// Read the input and perform OCR
var Result = Ocr.Read(Input);
// Extract all recognized text
var AllText = Result.Text;
// Output the recognized text to the console
Console.WriteLine(AllText);
}
}
}
' Import the IronOcr namespace
Imports IronOcr
Friend Class Program
Shared Sub Main()
' Create a new IronTesseract instance
Dim Ocr = New IronTesseract()
' Set the OCR language to Czech
Ocr.Language = OcrLanguage.Czech
' Define the input image or PDF and perform OCR
Using Input = New OcrInput("images\Czech.png")
' Read the input and perform OCR
Dim Result = Ocr.Read(Input)
' Extract all recognized text
Dim AllText = Result.Text
' Output the recognized text to the console
Console.WriteLine(AllText)
End Using
End Sub
End Class
- Powyższy kod pokazuje, jak skonfigurować i używać klasy
IronTesseractdo przeprowadzenia OCR na podanym obrazie lub PDF. - Upewnij się, że pakiet
IronOcr.Languages.Czechjest zainstalowany w twoim środowisku, aby kod wykonał się poprawnie. - Klasa
OcrInputsłuży do załadowania obrazu ze wskazanej ścieżki, aOcr.Read()wykonuje operację OCR. Result.Textbędzie zawierać wynik OCR, który w tym przypadku jest wydrukowany na konsolę.

