C# 和 .NET 中的南非荷兰语 OCR

This article was translated from English: Does it need improvement?
Translated
View the article in English
Other versions of this document:

在南非荷兰语中 新增 125 种 OCR 语言

IronOCR 是一个 C# 软件组件,允许 .NET 程序员从图像和 PDF 文档中读取 126 种语言(包括南非荷兰语)的文本。

它是 Tesseract 的一个高级分支,专为 .NET 开发人员构建,在速度和准确性方面通常优于其他 Tesseract 引擎。

IronOcr.Languages.Afrikaans 的内容

此软件包包含 52 种适用于 .NET 的 OCR 语言:

  • 南非荷兰语
  • 南非荷兰语Best
  • 南非荷兰语Fast

下载

南非荷兰语语言包[南非荷兰语]

安装

我们首先需要做的就是将我们的南非语OCR 包安装到您的 .NET 项目中。

Install-Package IronOCR.Languages.Afrikaans

代码示例

此 C# 代码示例从图像或 PDF 文档中读取南非荷兰语文本。

// First, ensure the IronOcr.Languages.Afrikaans package is installed in your project.
// This example requires the IronOcr C# package to read text from images or PDFs.

using IronOcr;

var Ocr = new IronTesseract(); // Initialize the IronTesseract class
Ocr.Language = OcrLanguage.Afrikaans; // Set the language to Afrikaans

// Load the image or PDF document into an OcrInput object
using (var Input = new OcrInput(@"images\Afrikaans.png"))
{
    // Perform OCR on the input document
    var Result = Ocr.Read(Input);

    // Retrieve the complete recognized text
    var AllText = Result.Text;

    // Output the recognized text (this step is customizable for your use-case)
    Console.WriteLine(AllText);
}
// First, ensure the IronOcr.Languages.Afrikaans package is installed in your project.
// This example requires the IronOcr C# package to read text from images or PDFs.

using IronOcr;

var Ocr = new IronTesseract(); // Initialize the IronTesseract class
Ocr.Language = OcrLanguage.Afrikaans; // Set the language to Afrikaans

// Load the image or PDF document into an OcrInput object
using (var Input = new OcrInput(@"images\Afrikaans.png"))
{
    // Perform OCR on the input document
    var Result = Ocr.Read(Input);

    // Retrieve the complete recognized text
    var AllText = Result.Text;

    // Output the recognized text (this step is customizable for your use-case)
    Console.WriteLine(AllText);
}
' First, ensure the IronOcr.Languages.Afrikaans package is installed in your project.
' This example requires the IronOcr C# package to read text from images or PDFs.

Imports IronOcr

Private Ocr = New IronTesseract() ' Initialize the IronTesseract class
Ocr.Language = OcrLanguage.Afrikaans ' Set the language to Afrikaans

' Load the image or PDF document into an OcrInput object
Using Input = New OcrInput("images\Afrikaans.png")
	' Perform OCR on the input document
	Dim Result = Ocr.Read(Input)

	' Retrieve the complete recognized text
	Dim AllText = Result.Text

	' Output the recognized text (this step is customizable for your use-case)
	Console.WriteLine(AllText)
End Using
$vbLabelText   $csharpLabel
  • PdfWriter:此对象负责写入PDF文件。它作用于文件路径,并写入有效PDF文档所需的结构。

  • IronTesseract :此类是 IronOCR 库的一部分,用于设置 OCR 过程。
  • OcrLanguage :此属性设置 OCR 的语言。 这里设置的是南非荷兰语。
  • OcrInput :此类封装了 OCR 过程的输入文件。 它支持多种图像格式和PDF文件。
  • Ocr.Read() :此方法执行 OCR 过程,并将识别出的文本包装在结果对象中返回。
  • Result.Text :此属性包含从输入文档中提取的文本。