使用 C# 和 .NET 进行汤加语 OCR 识别
This article was translated from English: Does it need improvement?
TranslatedView the article in English
IronOCR 是一个 C# 软件组件,它允许 .NET 开发人员从图像和 PDF 文档中读取 126 种语言(包括汤加语)的文本。 它是 Tesseract 的一个高级分支,专为 .NET 开发人员量身定制,在速度和准确性方面通常优于其他 Tesseract 引擎。
IronOcr.Languages.Tonga 的内容
此包包含三个针对汤加的 OCR 语言模型:
- 到达的
- 到达的Best
- 到达的Fast
下载
汤加语语言包[汤加语语言包]
安装
要开始使用Tonga OCR 功能,请使用以下 NuGet 命令将 Tonga OCR 包安装到您的 .NET 项目中:
Install-Package IronOCR.Languages.Tonga
代码示例
以下 C# 代码示例演示了如何使用 IronOCR 从图像或 PDF 文档中读取汤加语文本。
// Include the necessary IronOcr namespace
using IronOcr;
class TongaOcrExample
{
static void Main()
{
// Initialize the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Set the OCR engine to use the Tonga language pack
Ocr.Language = OcrLanguage.Tonga;
// Load the input image or PDF into OcrInput
using (var Input = new OcrInput(@"images\Tonga.png"))
{
// Perform OCR to read the text from the image
var Result = Ocr.Read(Input);
// Retrieve the full text recognition result
var AllText = Result.Text;
// Output the result or process further as needed
System.Console.WriteLine(AllText);
}
}
}// Include the necessary IronOcr namespace
using IronOcr;
class TongaOcrExample
{
static void Main()
{
// Initialize the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Set the OCR engine to use the Tonga language pack
Ocr.Language = OcrLanguage.Tonga;
// Load the input image or PDF into OcrInput
using (var Input = new OcrInput(@"images\Tonga.png"))
{
// Perform OCR to read the text from the image
var Result = Ocr.Read(Input);
// Retrieve the full text recognition result
var AllText = Result.Text;
// Output the result or process further as needed
System.Console.WriteLine(AllText);
}
}
}$vbLabelText $csharpLabel
- 此代码示例演示了如何初始化 IronTesseract OCR 引擎并将其设置为使用汤加语。
- 我们将指定路径中的图像加载到
OcrInput对象中。 Ocr.Read()方法处理输入以提取文本,然后我们通过Result.Text属性检索识别出的文本。 最后,提取的文本可以根据需要在应用程序中输出或处理。





