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.Romanian 的内容

此软件包包含 49 种适用于 .NET 的 OCR 语言:

  • 罗马尼亚语
  • RomanianBest
  • RomanianFast

下载

罗马尼亚语语言包[罗马尼亚语]

安装

我们首先需要做的是将我们的罗马尼亚语OCR 包安装到您的 .NET 项目中。

Install-Package IronOCR.Languages.Romanian

代码示例

这段 C# 代码示例从图像或 PDF 文档中读取罗马尼亚语文本。

// Ensure you have installed the Romanian OCR package using the following NuGet command:
// PM> Install-Package IronOCR.Languages.Romanian

using IronOcr;

var Ocr = new IronTesseract();
Ocr.Language = OcrLanguage.Romanian;

using (var Input = new OcrInput(@"images\Romanian.png")) 
{
    // Perform OCR on the input image, and store the result
    var Result = Ocr.Read(Input);

    // Extract all recognized text from the OCR result
    var AllText = Result.Text;

    // Display the recognized text
    Console.WriteLine(AllText);
}
// Ensure you have installed the Romanian OCR package using the following NuGet command:
// PM> Install-Package IronOCR.Languages.Romanian

using IronOcr;

var Ocr = new IronTesseract();
Ocr.Language = OcrLanguage.Romanian;

using (var Input = new OcrInput(@"images\Romanian.png")) 
{
    // Perform OCR on the input image, and store the result
    var Result = Ocr.Read(Input);

    // Extract all recognized text from the OCR result
    var AllText = Result.Text;

    // Display the recognized text
    Console.WriteLine(AllText);
}
' Ensure you have installed the Romanian OCR package using the following NuGet command:
' PM> Install-Package IronOCR.Languages.Romanian

Imports IronOcr

Private Ocr = New IronTesseract()
Ocr.Language = OcrLanguage.Romanian

Using Input = New OcrInput("images\Romanian.png")
	' Perform OCR on the input image, and store the result
	Dim Result = Ocr.Read(Input)

	' Extract all recognized text from the OCR result
	Dim AllText = Result.Text

	' Display the recognized text
	Console.WriteLine(AllText)
End Using
$vbLabelText   $csharpLabel

以上代码演示了如何设置 IronOCR 以从图像文件中读取罗马尼亚语文本。IronTesseract IronTesseract()初始化一个新的 OCR 引擎实例, OcrInput()加载要处理的图像。 Read()方法执行 OCR 操作。 最后,将识别出的文本存储在AllText变量中,然后将其打印到控制台。 请记住将"images\Romanian.png"替换为您的图像文件路径。