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 文档中识别和提取的所有文本。