Galician 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.Galician 的内容
此软件包包含 49 种适用于 .NET 的 OCR 语言,其中包括:
- 加利西亚语
- GalicianBest
- GalicianFast
下载
加利西亚语语言包[galego]
安装
要在 .NET 项目中使用Galician OCR 包,第一步是安装它。
Install-Package IronOcr.Languages.Galician
代码示例
以下 C# 代码示例演示了如何从图像或 PDF 文档中读取加利西亚语文本。
// Include the IronOcr library
using IronOcr;
class Program
{
static void Main()
{
// Instantiate the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Specify the language for OCR as Galician
Ocr.Language = OcrLanguage.Galician;
// Define the input source, here it is an image file
using (var Input = new OcrInput(@"images\Galician.png"))
{
// Perform the OCR process on the input image
var Result = Ocr.Read(Input);
// Retrieve the recognized text from the OCR result
var AllText = Result.Text;
// Output the extracted text to the console
Console.WriteLine(AllText);
}
}
}
// Include the IronOcr library
using IronOcr;
class Program
{
static void Main()
{
// Instantiate the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Specify the language for OCR as Galician
Ocr.Language = OcrLanguage.Galician;
// Define the input source, here it is an image file
using (var Input = new OcrInput(@"images\Galician.png"))
{
// Perform the OCR process on the input image
var Result = Ocr.Read(Input);
// Retrieve the recognized text from the OCR result
var AllText = Result.Text;
// Output the extracted text to the console
Console.WriteLine(AllText);
}
}
}
' Include the IronOcr library
Imports IronOcr
Friend Class Program
Shared Sub Main()
' Instantiate the IronTesseract OCR engine
Dim Ocr = New IronTesseract()
' Specify the language for OCR as Galician
Ocr.Language = OcrLanguage.Galician
' Define the input source, here it is an image file
Using Input = New OcrInput("images\Galician.png")
' Perform the OCR process on the input image
Dim Result = Ocr.Read(Input)
' Retrieve the recognized text from the OCR result
Dim AllText = Result.Text
' Output the extracted text to the console
Console.WriteLine(AllText)
End Using
End Sub
End Class
$vbLabelText
$csharpLabel
在上述代码中
- 我们使用 IronTesseract 类来创建一个 OCR 引擎对象。 我们将 OCR 语言设置为加利西亚语,以确保 OCR 引擎能够准确处理加利西亚语文本。 然后我们读取位于"images\Galician.png"的图像文件,并获取识别出的文本。
- 最后,我们将识别的文本打印到控制台。

