C# 中的哥特体字母 OCR

This article was translated from English: Does it need improvement?
Translated
View the article in English

还有126种语言

IronOCR 是一个 C# 软件组件,允许 .NET 程序员从图像和 PDF 文档中读取 126 种语言的文本,包括哥特体字母。

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

IronOcr.Languages.Fraktur 的内容

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

  • 哥特体字母
  • 哥特体字母Best
  • 哥特体字母Fast

下载

Fraktur 字母语言包[通用 Fraktur]

安装

我们首先要做的是将我们的Fraktur Alphabet OCR 包安装到您的 .NET 项目中。

Install-Package IronOCR.Languages.Fraktur

代码示例

这段 C# 代码示例从图像或 PDF 文档中读取哥特体字母文本。

// Requires the IronOcr NuGet package and the Fraktur language package to be installed.

using IronOcr;

class FrakturOCRExample
{
    static void Main()
    {
        // Create an instance of the IronTesseract class
        var Ocr = new IronTesseract();

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

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

            // Retrieve and display the recognized text
            var AllText = Result.Text;
            Console.WriteLine(AllText);
        }
    }
}
// Requires the IronOcr NuGet package and the Fraktur language package to be installed.

using IronOcr;

class FrakturOCRExample
{
    static void Main()
    {
        // Create an instance of the IronTesseract class
        var Ocr = new IronTesseract();

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

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

            // Retrieve and display the recognized text
            var AllText = Result.Text;
            Console.WriteLine(AllText);
        }
    }
}
' Requires the IronOcr NuGet package and the Fraktur language package to be installed.

Imports IronOcr

Friend Class FrakturOCRExample
	Shared Sub Main()
		' Create an instance of the IronTesseract class
		Dim Ocr = New IronTesseract()

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

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

			' Retrieve and display the recognized text
			Dim AllText = Result.Text
			Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel

在此示例中:

  • 我们创建了一个IronTesseract对象,它作为我们的 OCR 引擎。
  • 我们使用OcrLanguage.Fraktur将语言设置更改为 Fraktur。
  • 我们将图像文件( @"images\Fraktur.png" )加载到OcrInput对象中。
  • Ocr.Read()方法处理输入图像并返回 OCR 结果。 最后,我们将提取的文本打印到控制台。