Danish OCR in C# and .NET

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

IronOCR to komponent oprogramowania C# umożliwiający programistom .NET odczytywanie tekstu z obrazów i dokumentów PDF w 126 językach, w tym po duńsku.

Jest to zaawansowany fork Tesseract, zbudowany wyłącznie dla programistów .NET, i regularnie przewyższa inne silniki Tesseract zarówno pod względem szybkości, jak i dokładności.

Zawartość IronOcr.Languages.Danish

Ten pakiet zawiera 61 języków OCR dla .NET:

  • Danish
  • DanishBest
  • DanishFast
  • DanishFraktur

Pobieranie

Danish Language Pack [dansk]

Instalacja

Pierwszym krokiem jest zainstalowanie pakietu OCR Danish w swoim projekcie .NET.

Install-Package IronOcr.Languages.Danish

Przyklad kodu

Ten przykład kodu C# odczytuje tekst duński z obrazu lub dokumentu PDF za pomocą IronOCR.

// Import the IronOcr namespace to access OCR functionalities
using IronOcr;

class Program
{
    static void Main()
    {
        // Initialize the IronTesseract object, which will handle OCR operations
        var Ocr = new IronTesseract();

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

        // Using a 'using' statement to ensure the OcrInput object is disposed of correctly
        using (var Input = new OcrInput(@"images\Danish.png"))
        {
            // Perform OCR on the input image and store the result
            var Result = Ocr.Read(Input);

            // Extract the recognized text from the result
            var AllText = Result.Text;

            // Output the extracted text to the console
            Console.WriteLine(AllText);
        }
    }
}
// Import the IronOcr namespace to access OCR functionalities
using IronOcr;

class Program
{
    static void Main()
    {
        // Initialize the IronTesseract object, which will handle OCR operations
        var Ocr = new IronTesseract();

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

        // Using a 'using' statement to ensure the OcrInput object is disposed of correctly
        using (var Input = new OcrInput(@"images\Danish.png"))
        {
            // Perform OCR on the input image and store the result
            var Result = Ocr.Read(Input);

            // Extract the recognized text from the result
            var AllText = Result.Text;

            // Output the extracted text to the console
            Console.WriteLine(AllText);
        }
    }
}
' Import the IronOcr namespace to access OCR functionalities
Imports IronOcr

Friend Class Program
	Shared Sub Main()
		' Initialize the IronTesseract object, which will handle OCR operations
		Dim Ocr = New IronTesseract()

		' Set the language for OCR to Danish
		Ocr.Language = OcrLanguage.Danish

		' Using a 'using' statement to ensure the OcrInput object is disposed of correctly
		Using Input = New OcrInput("images\Danish.png")
			' Perform OCR on the input image and store the result
			Dim Result = Ocr.Read(Input)

			' Extract the recognized text from the result
			Dim AllText = Result.Text

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

Ten przykład pokazuje, jak skonfigurować IronOCR do odczytu tekstu duńskiego z pliku obrazka. Obiekt IronTesseract jest skonfigurowany do używania języka duńskiego, a obrazek jest ładowany za pomocą OcrInput. Ocr.Read wykonuje OCR, a rozpoznany tekst jest ekstrahowany i wypisywany.