C# 和 .NET 中的愛沙尼亞語 OCR

This article was translated from English: Does it need improvement?
Translated
View the article in English
Other versions of this document:

在愛沙尼亞語 新增 125 種 OCR 語言

IronOCR 是一個 C# 軟體元件,可讓 .NET 開發人員從圖像和 PDF 文件中讀取 126 種語言(包括愛沙尼亞語)的文字。 它是 Tesseract 的一個高級分支,專為 .NET 開發人員構建,在速度和準確性方面通常優於其他 Tesseract 引擎。

IronOcr.Languages.Estonian 的內容

此軟體包包含以下適用於 .NET 的 OCR 語言:

  • 愛沙尼亞語
  • 愛沙尼亞最佳
  • 愛沙尼亞快報

下載

愛沙尼亞語語言包[愛沙尼亞語]

安裝

我們首先需要做的是將我們的愛沙尼亞語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 文件中識別和提取的所有文字。