C# 和 .NET 中的俄语 OCR
This article was translated from English: Does it need improvement?
TranslatedView the article in English
Other versions of this document:
IronOCR 是一个 C# 软件组件,允许 .NET 程序员从图像和 PDF 文档中读取 126 种语言(包括俄语)的文本。
它是 Tesseract 的一个高级分支,专为 .NET 开发人员构建,在速度和准确性方面通常优于其他 Tesseract 引擎。
IronOcr.Languages.Russian 的内容
此软件包包含 46 种适用于 .NET 的 OCR 语言:
- 俄罗斯
- RussianBest
- RussianFast
下载
俄语语言包
安装
我们首先需要做的就是将我们的俄语OCR 包安装到您的 .NET 项目中。
Install-Package IronOCR.Languages.Russian
代码示例
此 C# 代码示例从图像或 PDF 文档中读取俄语文本。
// Import the IronOCR namespace
using IronOcr;
class Program
{
static void Main()
{
// Initialize IronTesseract, an OCR object
var Ocr = new IronTesseract();
// Set the OCR language to Russian
Ocr.Language = OcrLanguage.Russian;
// Create an OCR input for the Russian image
using (var Input = new OcrInput(@"images\Russian.png"))
{
// Perform OCR on the input image
var Result = Ocr.Read(Input);
// Extract all the recognized text
var AllText = Result.Text;
// Output the recognized text
System.Console.WriteLine(AllText);
}
}
}// Import the IronOCR namespace
using IronOcr;
class Program
{
static void Main()
{
// Initialize IronTesseract, an OCR object
var Ocr = new IronTesseract();
// Set the OCR language to Russian
Ocr.Language = OcrLanguage.Russian;
// Create an OCR input for the Russian image
using (var Input = new OcrInput(@"images\Russian.png"))
{
// Perform OCR on the input image
var Result = Ocr.Read(Input);
// Extract all the recognized text
var AllText = Result.Text;
// Output the recognized text
System.Console.WriteLine(AllText);
}
}
}' Import the IronOCR namespace
Imports IronOcr
Friend Class Program
Shared Sub Main()
' Initialize IronTesseract, an OCR object
Dim Ocr = New IronTesseract()
' Set the OCR language to Russian
Ocr.Language = OcrLanguage.Russian
' Create an OCR input for the Russian image
Using Input = New OcrInput("images\Russian.png")
' Perform OCR on the input image
Dim Result = Ocr.Read(Input)
' Extract all the recognized text
Dim AllText = Result.Text
' Output the recognized text
System.Console.WriteLine(AllText)
End Using
End Sub
End Class$vbLabelText $csharpLabel
- 上述代码导入了必要的 IronOCR 库并初始化了
IronTesseract,该类用于执行 OCR 任务。 - 它将 OCR 的语言设置为俄语,使用
Ocr.Language = OcrLanguage.Russian。 然后它使用OcrInput类打开指定的图像文件Russian.png。 Ocr对象的Read方法用于处理图像并识别文本, 最后,它从Result.Text中提取识别出的文本并输出。





