Fraktur Alphabet OCR in C#

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

另外 126 種語言

IronOCR is a C# software component allowing .NET coders to read text from images and PDF documents in 126 languages, including Fraktur Alphabet.

它是 Tesseract 的高級分支,專為 .NET 開發者而建造,並且在速度和精度上經常優於其他 Tesseract 引擎。

Contents of IronOcr.Languages.Fraktur

This package contains 70 OCR languages for .NET:

  • FrakturAlphabet
  • FrakturAlphabetBest
  • FrakturAlphabetFast

下載

Fraktur Alphabet Language Pack [Generic Fraktur]

安裝

The first thing we have to do is install our Fraktur Alphabet OCR package into your .NET project.

Install-Package IronOCR.Languages.Fraktur

代碼示例

This C# code example reads Fraktur Alphabet text from an Image or PDF document.

// 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

根據此示例:

  • We create an IronTesseract object which serves as our OCR engine.
  • We change the language setting to Fraktur using OcrLanguage.Fraktur.
  • We load an image file (@"images\Fraktur.png") into an OcrInput object.
  • The Ocr.Read() method processes the input image and returns the OCR result.
  • Finally, we print the extracted text to the console.