Romanian OCR in C# and .NET
本文档的其他版本:
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);
}
Imports IronOcr
' Ensure you have installed the Romanian OCR package using the following NuGet command:
' PM> Install-Package IronOcr.Languages.Romanian
Dim Ocr As New IronTesseract()
Ocr.Language = OcrLanguage.Romanian
Using Input As 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
以上代码演示了如何设置IronOCR以从图像文件中读取罗马尼亚语文本。IronTesseract() 初始化一个新的 OCR 引擎实例,而 OcrInput() 加载要处理的图像。 Read() 方法执行 OCR 操作。 最后,识别出的文本存储在 AllText 变量中,然后将其打印到控制台。 请记住将 "images\Romanian.png" 替换为您的图像文件路径。

