Welsh OCR in C# and .NET
This article was translated from English: Does it need improvement?
Translated
View the article in English
本文档的其他版本:
IronOCR 是一个 C# 软件组件,允许 .NET 程序员从图像和 PDF 文档中读取 126 种语言(包括威尔士语)的文本。 它是 Tesseract 的一个高级分支,专为 .NET 开发人员构建,在速度和准确性方面通常优于其他 Tesseract 引擎。
IronOcr.Languages.Welsh 的内容
此软件包包含三个版本的威尔士语 OCR 语言,适用于 .NET:
- 威尔士语
- 威尔士语Best
- 威尔士快车
下载
威尔士语包[威尔士语]
安装
第一步是在您的 .NET 项目中安装威尔士语OCR 包。
Install-Package IronOcr.Languages.Welsh
代码示例
此 C# 代码示例演示了如何从图像或 PDF 文档中读取威尔士语文本。
// Import the IronOcr namespace
using IronOcr;
class Program
{
static void Main()
{
// Create an instance of IronTesseract
var Ocr = new IronTesseract();
// Set the language to Welsh
Ocr.Language = OcrLanguage.Welsh;
// Read text from the given image
using (var Input = new OcrInput(@"images\Welsh.png"))
{
// Perform OCR and get the result
var Result = Ocr.Read(Input);
// Extract all recognized text
var AllText = Result.Text;
// Output text to the console
Console.WriteLine(AllText);
}
}
}
// Import the IronOcr namespace
using IronOcr;
class Program
{
static void Main()
{
// Create an instance of IronTesseract
var Ocr = new IronTesseract();
// Set the language to Welsh
Ocr.Language = OcrLanguage.Welsh;
// Read text from the given image
using (var Input = new OcrInput(@"images\Welsh.png"))
{
// Perform OCR and get the result
var Result = Ocr.Read(Input);
// Extract all recognized text
var AllText = Result.Text;
// Output text to the console
Console.WriteLine(AllText);
}
}
}
' Import the IronOcr namespace
Imports IronOcr
Friend Class Program
Shared Sub Main()
' Create an instance of IronTesseract
Dim Ocr = New IronTesseract()
' Set the language to Welsh
Ocr.Language = OcrLanguage.Welsh
' Read text from the given image
Using Input = New OcrInput("images\Welsh.png")
' Perform OCR and get the result
Dim Result = Ocr.Read(Input)
' Extract all recognized text
Dim AllText = Result.Text
' Output text to the console
Console.WriteLine(AllText)
End Using
End Sub
End Class
$vbLabelText
$csharpLabel
在此代码中:
- 首先使用
IronOcr命名空间来访问OCR功能。 - 创建
IronTesseract的实例,这是IronOCR提供的用于执行OCR操作的主要类。 - 使用
Ocr.Language = OcrLanguage.Welsh将OCR语言设置为威尔士语。 - 打开位于
Welsh.png的图像文件进行OCR处理。 - 最后,
AllText中。 - 然后,将识别出的威尔士语文本打印到控制台上。

