Estonian OCR in C# and .NET

This article was translated from English: Does it need improvement?
Translated
View the article in English
Inne wersje tego dokumentu:

IronOCR to komponent oprogramowania w C#, który umożliwia programistom .NET odczytywanie tekstu z obrazów i dokumentów PDF w 126 językach, w tym w języku estońskim. 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.Estonian

Pakiet zawiera następujące języki OCR dla .NET:

  • Estonian
  • EstonianBest
  • EstonianFast

Pobieranie

Estonian Language Pack [eesti]

Instalacja

Pierwszą rzeczą, którą musimy zrobić, jest zainstalowanie naszego pakietu OCR estońskiego w projekcie .NET.

Install-Package IronOcr.Languages.Estonian

Przyklad kodu

Ten przykład kodu C# odczytuje tekst w języku estońskim z obrazu lub dokumentu PDF.

// Import the IronOcr namespace
using IronOcr;

// Create a new instance of the IronTesseract class
var Ocr = new IronTesseract();

// Set the OCR language to Estonian
Ocr.Language = OcrLanguage.Estonian;

// Load the image or PDF from which text needs to be extracted
using (var Input = new OcrInput(@"images\Estonian.png"))
{
    // Perform OCR to read text from the specified input
    var Result = Ocr.Read(Input);

    // Extract all the recognized text from the OCR result
    var AllText = Result.Text;
}
// Import the IronOcr namespace
using IronOcr;

// Create a new instance of the IronTesseract class
var Ocr = new IronTesseract();

// Set the OCR language to Estonian
Ocr.Language = OcrLanguage.Estonian;

// Load the image or PDF from which text needs to be extracted
using (var Input = new OcrInput(@"images\Estonian.png"))
{
    // Perform OCR to read text from the specified input
    var Result = Ocr.Read(Input);

    // Extract all the recognized text from the OCR result
    var AllText = Result.Text;
}
' Import the IronOcr namespace
Imports IronOcr

' Create a new instance of the IronTesseract class
Private Ocr = New IronTesseract()

' Set the OCR language to Estonian
Ocr.Language = OcrLanguage.Estonian

' Load the image or PDF from which text needs to be extracted
Using Input = New OcrInput("images\Estonian.png")
	' Perform OCR to read text from the specified input
	Dim Result = Ocr.Read(Input)

	' Extract all the recognized text from the OCR result
	Dim AllText = Result.Text
End Using
$vbLabelText   $csharpLabel

Wyjaśnienie kodu:

  • IronTesseract: To jest główna klasa dostarczana przez IronOCR do wykonywania operacji OCR.
  • Ocr.Language: Ustawiając tę właściwość, definiujemy, którego języka należy użyć podczas OCR. Tutaj jest ustawiony na język estoński.
  • OcrInput: Używamy tego do określenia obrazu lub dokumentu PDF, z którego chcemy odczytać. Przyjmuje jako wejście ścieżkę do pliku.
  • Ocr.Read(Input): Ta metoda przetwarza określone wejście i wykonuje na nim OCR.
  • Result.Text: Ta właściwość zawiera cały tekst, który został pomyślnie rozpoznany i wyodrębniony z obrazu lub dokumentu PDF.