Estonian OCR in C# and .NET

This article was translated from English: Does it need improvement?
Translated
View the article in English
此文件的其他版本:

IronOCR是一個C#的軟體元件,允許.NET開發人員從圖像和PDF文件讀取126種語言的文字,包括愛沙尼亞語。 它是 Tesseract 的一個進階分支,專為 .NET 開發者而建構,在速度和準確性方面經常超越其他 Tesseract 引擎。

IronOcr.Languages.Estonian的內容

此套件包含以下.NET的OCR語言:

  • Estonian
  • EstonianBest
  • EstonianFast

下載

愛沙尼亞語語言包 [eesti]

安裝

我們首先需要做的是將我們的愛沙尼亞語OCR套件安裝到您的.NET專案中。

Install-Package IronOcr.Languages.Estonian

程式範例

此C#程式碼範例從圖像或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

程式碼解釋:

  • IronTesseract:這是IronOCR提供的主要類別,用於執行OCR操作。
  • Ocr.Language:通過設置此屬性,我們定義了應在OCR期間使用的語言。 在這裡,它被設置為愛沙尼亞語。
  • OcrInput:此用於指定我們要從中讀取的圖像或PDF文件。 它接受作為輸入的文件路徑。
  • Ocr.Read(Input):此方法處理指定的輸入並對其進行OCR。
  • Result.Text:此屬性包含已成功識別和從圖像或PDF文件中提取的所有文字。