C# 和 .NET 中的冰島語 OCR

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

在冰島語 新增 125 種 OCR 語言

IronOCR 是一個 C# 軟體元件,允許 .NET 程式設計師從圖像和 PDF 文件中讀取 126 種語言(包括冰島語)的文字。 它是 Tesseract 的一個高級分支,專為 .NET 開發人員構建,在速度和準確性方面通常優於其他 Tesseract 引擎。

IronOcr.Languages.Icelandic 的內容

此軟體包包含 52 種適用於 .NET 的 OCR 語言:

  • 冰島語
  • IcelandicBest
  • IcelandicFast

下載

冰島語語言包[冰島語]

安裝

我們首先需要做的是將我們的冰島語OCR 套件安裝到您的 .NET 專案中。

Install-Package IronOCR.Languages.Icelandic

程式碼範例

這段 C# 程式碼範例從圖像或 PDF 文件中讀取冰島語文字。

using IronOcr;

class Program
{
    static void Main()
    {
        // Create an instance of the IronTesseract OCR engine
        var Ocr = new IronTesseract();

        // Set the language to Icelandic
        Ocr.Language = OcrLanguage.Icelandic;

        // Load the image or PDF file to be processed
        using (var Input = new OcrInput(@"images\Icelandic.png"))
        {
            // Perform OCR on the input file
            var Result = Ocr.Read(Input);

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

            // Print the extracted text to the console
            System.Console.WriteLine(AllText);
        }
    }
}
using IronOcr;

class Program
{
    static void Main()
    {
        // Create an instance of the IronTesseract OCR engine
        var Ocr = new IronTesseract();

        // Set the language to Icelandic
        Ocr.Language = OcrLanguage.Icelandic;

        // Load the image or PDF file to be processed
        using (var Input = new OcrInput(@"images\Icelandic.png"))
        {
            // Perform OCR on the input file
            var Result = Ocr.Read(Input);

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

            // Print the extracted text to the console
            System.Console.WriteLine(AllText);
        }
    }
}
Imports IronOcr

Friend Class Program
	Shared Sub Main()
		' Create an instance of the IronTesseract OCR engine
		Dim Ocr = New IronTesseract()

		' Set the language to Icelandic
		Ocr.Language = OcrLanguage.Icelandic

		' Load the image or PDF file to be processed
		Using Input = New OcrInput("images\Icelandic.png")
			' Perform OCR on the input file
			Dim Result = Ocr.Read(Input)

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

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

說明

  • IronTesseract類別是 IronOcr 程式庫的一部分,旨在執行 OCR 操作。
  • Ocr.Language = OcrLanguage.Icelandic;將 OCR 語言設定為冰島語。
  • OcrInput接受輸入檔案(影像或 PDF)的路徑,並準備對其進行處理。
  • Ocr.Read(Input)處理輸入檔並傳回 OCR 結果。
  • Result.Text從處理後的輸入中檢索所有已識別的文字。

若要成功執行此範例,請確保您的 .NET 專案中已安裝 IronOCR 程式庫及其冰島語語言套件。