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.Irish 的内容
此软件包包含 40 种适用于 .NET 的 OCR 语言:
- 爱尔兰
- IrishBest
- 爱尔兰快车
下载
爱尔兰语语言包[爱尔兰语]
安装
我们首先需要做的是将我们的爱尔兰语OCR 包安装到您的 .NET 项目中。
Install-Package IronOCR.Languages.Irish
代码示例
此 C# 代码示例从图像或 PDF 文档中读取爱尔兰语文本。
// Install the IronOCR Irish language package via NuGet:
// PM> Install-Package IronOCR.Languages.Irish
using IronOcr;
class IrishOcrExample
{
static void Main()
{
// Create a new instance of the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Set the language to Irish for OCR processing
Ocr.Language = OcrLanguage.Irish;
// Using the OCR input, specify the path to the image containing Irish text
using (var Input = new OcrInput(@"images\Irish.png"))
{
// Perform OCR to read the Irish text from the image
var Result = Ocr.Read(Input);
// Get the recognized text as a string from the OCR result
var AllText = Result.Text;
// Output the recognized text
Console.WriteLine(AllText);
}
}
}// Install the IronOCR Irish language package via NuGet:
// PM> Install-Package IronOCR.Languages.Irish
using IronOcr;
class IrishOcrExample
{
static void Main()
{
// Create a new instance of the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Set the language to Irish for OCR processing
Ocr.Language = OcrLanguage.Irish;
// Using the OCR input, specify the path to the image containing Irish text
using (var Input = new OcrInput(@"images\Irish.png"))
{
// Perform OCR to read the Irish text from the image
var Result = Ocr.Read(Input);
// Get the recognized text as a string from the OCR result
var AllText = Result.Text;
// Output the recognized text
Console.WriteLine(AllText);
}
}
}' Install the IronOCR Irish language package via NuGet:
' PM> Install-Package IronOCR.Languages.Irish
Imports IronOcr
Friend Class IrishOcrExample
Shared Sub Main()
' Create a new instance of the IronTesseract OCR engine
Dim Ocr = New IronTesseract()
' Set the language to Irish for OCR processing
Ocr.Language = OcrLanguage.Irish
' Using the OCR input, specify the path to the image containing Irish text
Using Input = New OcrInput("images\Irish.png")
' Perform OCR to read the Irish text from the image
Dim Result = Ocr.Read(Input)
' Get the recognized text as a string from the OCR result
Dim AllText = Result.Text
' Output the recognized text
Console.WriteLine(AllText)
End Using
End Sub
End Class$vbLabelText $csharpLabel
在这个例子中,我们利用 IronOCR 库中的 IronTesseract 类对包含爱尔兰语文本的图像执行 OCR。 OcrInput对象用于加载图像, Ocr.Read方法用于处理图像以提取文本。 然后将生成的文本存储在AllText变量中,并打印到控制台。





