C# 和 .NET 中的冰岛语 OCR
This article was translated from English: Does it need improvement?
TranslatedView the article in English
Other versions of this document:
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 库及其冰岛语语言包。





