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 開發人員能夠從 126 種語言(包括冰島語)的圖片和 PDF 文件中讀取文字。 這是 Tesseract 的進階分支版本,專為 .NET 開發者打造,其速度與準確度均經常優於其他 Tesseract 引擎。
IronOcr.Languages.Icelandic 的內容
此套件包含 52 種適用於 .NET 的 OCR 語言:
- 冰島語
- 冰島語Best
- 冰島語Fast
下載
冰島語語言套件 [Í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.Co/nsole.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.Co/nsole.WriteLine(AllText);
}
}
}
Imports IronOcr
Class Program
Shared Sub Main()
' Create an instance of the IronTesseract OCR engine
Dim Ocr As New IronTesseract()
' Set the language to Icelandic
Ocr.Language = OcrLanguage.Icelandic
' Load the image or PDF file to be processed
Using Input As 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 程式庫及其冰島語語言套件,才能成功執行此範例。

