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.Vietnamese 的内容
此软件包包含 132 种适用于 .NET 的 OCR 语言:
- 越南语
- VietnameseBest
- VietnameseFast
- 越南语字母
- VietnameseAlphabetBest
- VietnameseAlphabetFast
下载
越南语语言包
安装
我们首先需要做的就是将我们的越南语OCR 包安装到您的 .NET 项目中。
Install-Package IronOCR.Languages.Vietnamese
代码示例
此 C# 代码示例从图像或 PDF 文档中读取越南语文本。
// You need to install the IronOCR.Languages.Vietnamese package using the following NuGet command before running this code:
// PM> Install-Package IronOCR.Languages.Vietnamese
using IronOcr;
var Ocr = new IronTesseract();
// Set the OCR language to Vietnamese
Ocr.Language = OcrLanguage.Vietnamese;
using (var Input = new OcrInput(@"images\Vietnamese.png"))
{
// Perform OCR on the input image
var Result = Ocr.Read(Input);
// Extract all recognized text
var AllText = Result.Text;
// Example: Output the extracted text to the console
Console.WriteLine(AllText);
}// You need to install the IronOCR.Languages.Vietnamese package using the following NuGet command before running this code:
// PM> Install-Package IronOCR.Languages.Vietnamese
using IronOcr;
var Ocr = new IronTesseract();
// Set the OCR language to Vietnamese
Ocr.Language = OcrLanguage.Vietnamese;
using (var Input = new OcrInput(@"images\Vietnamese.png"))
{
// Perform OCR on the input image
var Result = Ocr.Read(Input);
// Extract all recognized text
var AllText = Result.Text;
// Example: Output the extracted text to the console
Console.WriteLine(AllText);
}' You need to install the IronOCR.Languages.Vietnamese package using the following NuGet command before running this code:
' PM> Install-Package IronOCR.Languages.Vietnamese
Imports IronOcr
Private Ocr = New IronTesseract()
' Set the OCR language to Vietnamese
Ocr.Language = OcrLanguage.Vietnamese
Using Input = New OcrInput("images\Vietnamese.png")
' Perform OCR on the input image
Dim Result = Ocr.Read(Input)
' Extract all recognized text
Dim AllText = Result.Text
' Example: Output the extracted text to the console
Console.WriteLine(AllText)
End Using$vbLabelText $csharpLabel
在此代码示例中:
- 我们创建
IronTesseract的一个实例。 - 使用
Ocr.Language = OcrLanguage.Vietnamese; - 创建一个
OcrInput对象,并传入图像或 PDF 的路径。 - 调用
Read方法执行 OCR 并获取提取的文本。 - 提取的文本存储在
AllText中,可以根据需要使用,例如显示或保存到文件中。





