Fraktur Alphabet OCR in C

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

126 種其他語言

IronOCR 是一款 C# 軟體元件,讓 .NET 開發人員能夠從 126 種語言的圖像和 PDF 文件中讀取文字,其中包括黑體字(Fraktur Alphabet)。

這是 Tesseract 的進階分支版本,專為 .NET 開發人員打造,無論在速度或準確度上,其表現均經常優於其他 Tesseract 引擎。

IronOcr.Languages.Fraktur 的內容

此套件包含 70 種適用於 .NET 的 OCR 語言:

  • FrakturAlphabet
  • FrakturAlphabetBest
  • FrakturAlphabetFast

下載

Fraktur 字母語言套件 [通用 Fraktur]

安裝

我們首先必須將 Fraktur Alphabet OCR 套件安裝至您的 .NET 專案中。

Install-Package IronOcr.Languages.Fraktur

程式碼範例

此 C# 程式碼範例會從圖片或 PDF 文件中讀取 Fraktur 字母表文字。

// 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 結果。
  • 最後,我們將擷取的文字PRINT至控制台。