Russian OCR in C# and .NET
Inne wersje tego dokumentu:
IronOCR to komponent oprogramowania C# pozwalający programistom .NET na odczyt tekstu z obrazów i dokumentów PDF w 126 językach, w tym w rosyjskim.
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.Russian
Ten pakiet zawiera 46 języków OCR dla .NET:
- Russian
- RussianBest
- RussianFast
Pobieranie
Russian Language Pack [русский язык]
Instalacja
Pierwszą rzeczą, którą musimy zrobić, to zainstalować nasz pakiet Russian OCR do twojego projektu .NET.
Install-Package IronOcr.Languages.Russian
Przyklad kodu
Ten przykład kodu C# odczytuje rosyjski tekst z obrazu lub dokumentu PDF.
// Import the IronOCR namespace
using IronOcr;
class Program
{
static void Main()
{
// Initialize IronTesseract, an OCR object
var Ocr = new IronTesseract();
// Set the OCR language to Russian
Ocr.Language = OcrLanguage.Russian;
// Create an OCR input for the Russian image
using (var Input = new OcrInput(@"images\Russian.png"))
{
// Perform OCR on the input image
var Result = Ocr.Read(Input);
// Extract all the recognized text
var AllText = Result.Text;
// Output the recognized text
System.Console.WriteLine(AllText);
}
}
}
// Import the IronOCR namespace
using IronOcr;
class Program
{
static void Main()
{
// Initialize IronTesseract, an OCR object
var Ocr = new IronTesseract();
// Set the OCR language to Russian
Ocr.Language = OcrLanguage.Russian;
// Create an OCR input for the Russian image
using (var Input = new OcrInput(@"images\Russian.png"))
{
// Perform OCR on the input image
var Result = Ocr.Read(Input);
// Extract all the recognized text
var AllText = Result.Text;
// Output the recognized text
System.Console.WriteLine(AllText);
}
}
}
' Import the IronOCR namespace
Imports IronOcr
Friend Class Program
Shared Sub Main()
' Initialize IronTesseract, an OCR object
Dim Ocr = New IronTesseract()
' Set the OCR language to Russian
Ocr.Language = OcrLanguage.Russian
' Create an OCR input for the Russian image
Using Input = New OcrInput("images\Russian.png")
' Perform OCR on the input image
Dim Result = Ocr.Read(Input)
' Extract all the recognized text
Dim AllText = Result.Text
' Output the recognized text
System.Console.WriteLine(AllText)
End Using
End Sub
End Class
- Powyższy kod importuje niezbędną bibliotekę IronOCR i inicjalizuje
IronTesseract, klasę używaną do wykonywania zadań OCR. - Ustawia język dla OCR na rosyjski używając
Ocr.Language = OcrLanguage.Russian. - Następnie otwiera określony plik obrazu
Russian.pngużywając klasyOcrInput. - Metoda
ReadobiektuOcrjest używana do przetwarzania obrazu i rozpoznawania tekstu, - Na koniec wyodrębnia rozpoznany tekst z
Result.Texti wyprowadza go.

