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.Arabic 的内容
此软件包包含 108 种适用于 .NET 的 OCR 语言:
- 阿拉伯语
- 阿拉伯文最佳
- ArabicFast
- 阿拉伯字母
- ArabicAlphabetBest
- ArabicAlphabetFast
下载
阿拉伯语语言包[阿拉伯语]
安装
我们首先需要做的就是将阿拉伯语OCR 包安装到您的 .NET 项目中。
Install-Package IronOCR.Languages.Arabic
代码示例
此 C# 代码示例从图像或 PDF 文档中读取阿拉伯语文本。
// Import the IronOcr namespace to use its classes.
using IronOcr;
// Create a new instance of the IronTesseract class.
var Ocr = new IronTesseract();
// Set the OCR language to Arabic.
Ocr.Language = OcrLanguage.Arabic;
// Use a using statement to ensure that resources are disposed of correctly.
using (var Input = new OcrInput(@"images\Arabic.png"))
{
// Perform OCR on the input image or document.
var Result = Ocr.Read(Input);
// Retrieve all recognized text from the document.
var AllText = Result.Text;
// Optionally, you can output the text to the console or use it otherwise.
// Console.WriteLine(AllText);
}// Import the IronOcr namespace to use its classes.
using IronOcr;
// Create a new instance of the IronTesseract class.
var Ocr = new IronTesseract();
// Set the OCR language to Arabic.
Ocr.Language = OcrLanguage.Arabic;
// Use a using statement to ensure that resources are disposed of correctly.
using (var Input = new OcrInput(@"images\Arabic.png"))
{
// Perform OCR on the input image or document.
var Result = Ocr.Read(Input);
// Retrieve all recognized text from the document.
var AllText = Result.Text;
// Optionally, you can output the text to the console or use it otherwise.
// Console.WriteLine(AllText);
}' Import the IronOcr namespace to use its classes.
Imports IronOcr
' Create a new instance of the IronTesseract class.
Private Ocr = New IronTesseract()
' Set the OCR language to Arabic.
Ocr.Language = OcrLanguage.Arabic
' Use a using statement to ensure that resources are disposed of correctly.
Using Input = New OcrInput("images\Arabic.png")
' Perform OCR on the input image or document.
Dim Result = Ocr.Read(Input)
' Retrieve all recognized text from the document.
Dim AllText = Result.Text
' Optionally, you can output the text to the console or use it otherwise.
' Console.WriteLine(AllText);
End Using$vbLabelText $csharpLabel





