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

此软件包包含对 49 种 .NET OCR 语言的支持,其中包括:

  • 克罗地亚语
  • CroatianBest
  • CroatianFast

下载

克罗地亚语语言包[克罗地亚语]

安装

第一步是使用 NuGet 将克罗地亚语OCR 包安装到您的 .NET 项目中。

Install-Package IronOCR.Languages.Croatian

代码示例

这段 C# 代码示例从图像或 PDF 文档中读取克罗地亚语文本。

// Add the required namespace for IronOCR
using IronOcr;

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

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

        // Define the input image or PDF containing Croatian text
        using (var Input = new OcrInput(@"images\Croatian.png"))
        {
            // Perform OCR on the input
            var Result = Ocr.Read(Input);

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

            // Output the recognized text to the console
            System.Console.WriteLine(AllText);
        }
    }
}
// Add the required namespace for IronOCR
using IronOcr;

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

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

        // Define the input image or PDF containing Croatian text
        using (var Input = new OcrInput(@"images\Croatian.png"))
        {
            // Perform OCR on the input
            var Result = Ocr.Read(Input);

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

            // Output the recognized text to the console
            System.Console.WriteLine(AllText);
        }
    }
}
' Add the required namespace for IronOCR
Imports IronOcr

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

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

		' Define the input image or PDF containing Croatian text
		Using Input = New OcrInput("images\Croatian.png")
			' Perform OCR on the input
			Dim Result = Ocr.Read(Input)

			' Extract all recognized text
			Dim AllText = Result.Text

			' Output the recognized text to the console
			System.Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel

解释

  • IronTesseract :这是用于执行 OCR 操作的主要类。 它可以读取图像或 PDF 中的文本,并支持多种语言。
  • OcrInput :表示 OCR 的输入源,可以是图像或 PDF 文件。
  • Ocr.Read :对指定的输入执行 OCR 过程。
  • Result.Text :包含从输入中提取的文本,然后将其打印到控制台。