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.Luxembourgish 的内容

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

  • 卢森堡语
  • 卢森堡最佳
  • 卢森堡快报

下载

卢森堡语语言包[卢森堡语]

安装

我们首先要做的是将卢森堡语OCR 包安装到您的 .NET 项目中。

Install-Package IronOCR.Languages.Luxembourgish

代码示例

这段 C# 代码示例从图像或 PDF 文档中读取卢森堡语文本。

// Import the IronOcr namespace to utilize OCR functions
using IronOcr;

class Program
{
    static void Main()
    {
        // Create a new instance of IronTesseract to perform OCR
        var Ocr = new IronTesseract();

        // Set the language for OCR to Luxembourgish
        Ocr.Language = OcrLanguage.Luxembourgish;

        // Load the input image or PDF from which to extract the text
        using (var Input = new OcrInput(@"images\Luxembourgish.png"))
        {
            // Perform OCR on the input document
            var Result = Ocr.Read(Input);

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

            // Output the recognized text
            Console.WriteLine(AllText);
        }
    }
}
// Import the IronOcr namespace to utilize OCR functions
using IronOcr;

class Program
{
    static void Main()
    {
        // Create a new instance of IronTesseract to perform OCR
        var Ocr = new IronTesseract();

        // Set the language for OCR to Luxembourgish
        Ocr.Language = OcrLanguage.Luxembourgish;

        // Load the input image or PDF from which to extract the text
        using (var Input = new OcrInput(@"images\Luxembourgish.png"))
        {
            // Perform OCR on the input document
            var Result = Ocr.Read(Input);

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

            // Output the recognized text
            Console.WriteLine(AllText);
        }
    }
}
' Import the IronOcr namespace to utilize OCR functions
Imports IronOcr

Friend Class Program
	Shared Sub Main()
		' Create a new instance of IronTesseract to perform OCR
		Dim Ocr = New IronTesseract()

		' Set the language for OCR to Luxembourgish
		Ocr.Language = OcrLanguage.Luxembourgish

		' Load the input image or PDF from which to extract the text
		Using Input = New OcrInput("images\Luxembourgish.png")
			' Perform OCR on the input document
			Dim Result = Ocr.Read(Input)

			' Retrieve the recognized text from the result
			Dim AllText = Result.Text

			' Output the recognized text
			Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel
  • 此示例演示了如何使用 IronOCR 从本地文档中识别卢森堡语文本。
  • 语言设置为卢森堡语,以提高对该语言文本的识别准确率。
  • OcrInput()用于指定输入图像或 PDF 文件。
  • Ocr.Read()处理文档,并通过Result.Text访问识别出的文本。