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 語言:

  • 哥德體字母
  • 哥德體字母表最佳
  • 哥德體字母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 結果。 最後,我們將提取的文字列印到控制台。