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

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

  • 捷克语
  • 捷克语Best
  • 捷克语Fast

下载

捷克语包[捷克语]

安装

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

Install-Package IronOCR.Languages.Czech

代码示例

此 C# 代码示例从图像或 PDF 文档中读取捷克语文本。

// Import the IronOcr namespace
using IronOcr;

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

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

        // Define the input image or PDF and perform OCR
        using (var Input = new OcrInput(@"images\Czech.png"))
        {
            // Read the input and perform OCR
            var Result = Ocr.Read(Input);

            // Extract all recognized text
            var AllText = Result.Text;

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

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

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

        // Define the input image or PDF and perform OCR
        using (var Input = new OcrInput(@"images\Czech.png"))
        {
            // Read the input and perform OCR
            var Result = Ocr.Read(Input);

            // Extract all recognized text
            var AllText = Result.Text;

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

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

		' Set the OCR language to Czech
		Ocr.Language = OcrLanguage.Czech

		' Define the input image or PDF and perform OCR
		Using Input = New OcrInput("images\Czech.png")
			' Read the input and perform OCR
			Dim Result = Ocr.Read(Input)

			' Extract all recognized text
			Dim AllText = Result.Text

			' Output the recognized text to the console
			Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel
  • 上述代码演示了如何配置和使用IronTesseract类对给定的图像或 PDF 执行 OCR。
  • 请确保您的环境中已安装IronOCR.Languages.Czech软件包,以便代码能够正确执行。
  • OcrInput类用于从指定路径加载图像, Ocr.Read()执行 OCR 操作。
  • Result.Text将包含 OCR 输出,在本例中,该输出将打印到控制台。