Danish OCR in C# and .NET

This article was translated from English: Does it need improvement?
Translated
View the article in English
Other versions of this document:

IronOCR是一個C#軟件組件,允許.NET開發人員從圖像和PDF文件中讀取文本,支持126種語言,包括丹麥語。

它是Tesseract的一個高級分支,專為.NET開發人員構建,並在速度和準確性上經常超越其他Tesseract引擎。

IronOcr.Languages.Danish的內容

此套件包含 61 種 .NET 的 OCR 語言:

  • Danish
  • DanishBest
  • DanishFast
  • DanishFraktur

下載

丹麥語語言包 style='white-space:default'>[dansk]

安裝

第一步是將丹麥語OCR包安裝到您的.NET項目中。

Install-Package IronOCR.Languages.Danish

代碼示例

這個C#代碼示例使用IronOCR從圖像或PDF文件中讀取丹麥語文本。

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

這個示例演示了如何設置IronOCR以從圖像文件讀取丹麥語文本。IronTesseract對象配置為使用丹麥語言,並用OcrInput加載圖像。 Ocr.Read執行OCR,並提取和打印識別出的文本。