Icelandic OCR in C# and .NET

This article was translated from English: Does it need improvement?
Translated
View the article in English
本文檔的其他版本:

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

IronOCR的內容.語言.冰島語

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

  • 冰島語
  • IcelandicBest
  • IcelandicFast

下載

冰島語語言包[Íslenska]

安裝

我們首先需要做的是將我們的冰島語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);
        }
    }
}
$vbLabelText   $csharpLabel

解釋

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

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