附加 OCR 语言包

This article was translated from English: Does it need improvement?
Translated
View the article in English

IronOCR 支持 125 种国际语言,但只有 英语 作为标准配置安装在 IronOCR 中。

您可以轻松地将其他语言包添加到您的 C#、VB 或 ASP .NET 通过 NuGet 或作为 Dlls(可下载并添加为项目引用)添加到项目中。



代码示例

国际语言范例

//PM> Install-Package IronOcr.Languages.ChineseSimplified

using IronOcr;

IronTesseract ocr = new IronTesseract();
ocr.Language = OcrLanguage.ChineseSimplified;

using (var input = new OcrInput())
{
    input.AddImage("img/chinese.gif");

    // Add image filters if needed
    // Input.Deskew();
    // Input.DeNoise();

    OcrResult result = ocr.Read(input);

    string TestResult = result.Text;

    // Console can't print unicode. Save to disk instead.
    result.SaveAsTextFile("chinese.txt");
}
//PM> Install-Package IronOcr.Languages.ChineseSimplified

using IronOcr;

IronTesseract ocr = new IronTesseract();
ocr.Language = OcrLanguage.ChineseSimplified;

using (var input = new OcrInput())
{
    input.AddImage("img/chinese.gif");

    // Add image filters if needed
    // Input.Deskew();
    // Input.DeNoise();

    OcrResult result = ocr.Read(input);

    string TestResult = result.Text;

    // Console can't print unicode. Save to disk instead.
    result.SaveAsTextFile("chinese.txt");
}
'PM> Install-Package IronOcr.Languages.ChineseSimplified

Imports IronOcr

Private ocr As New IronTesseract()
ocr.Language = OcrLanguage.ChineseSimplified

Using input = New OcrInput()
	input.AddImage("img/chinese.gif")

	' Add image filters if needed
	' Input.Deskew();
	' Input.DeNoise();

	Dim result As OcrResult = ocr.Read(input)

	Dim TestResult As String = result.Text

	' Console can't print unicode. Save to disk instead.
	result.SaveAsTextFile("chinese.txt")
End Using
VB   C#

垂直书写语言示例

为竖写语言调整词典。 使用韩国和日本 OcrLanguage 的 "竖写 "变体。

using IronOcr;

IronTesseract ocr = new IronTesseract();
ocr.Language = OcrLanguage.JapaneseVertical;

using (var input = new OcrInput(@"images\image.png"))
{
    OcrResult result = ocr.Read(input);
    Console.WriteLine(result.Text);
}
using IronOcr;

IronTesseract ocr = new IronTesseract();
ocr.Language = OcrLanguage.JapaneseVertical;

using (var input = new OcrInput(@"images\image.png"))
{
    OcrResult result = ocr.Read(input);
    Console.WriteLine(result.Text);
}
Imports IronOcr

Private ocr As New IronTesseract()
ocr.Language = OcrLanguage.JapaneseVertical

Using input = New OcrInput("images\image.png")
	Dim result As OcrResult = ocr.Read(input)
	Console.WriteLine(result.Text)
End Using
VB   C#

自定义语言示例

使用您下载或自行训练的任何 Tesseract .Traineddata 语言文件

using IronOcr;

IronTesseract ocr = new IronTesseract();

ocr.UseCustomTesseractLanguageFile("custom_tesseract_files/custom.traineddata");

using (var input = new OcrInput(@"images\image.png"))
{
    OcrResult result = ocr.Read(input);
    Console.WriteLine(result.Text);
}
using IronOcr;

IronTesseract ocr = new IronTesseract();

ocr.UseCustomTesseractLanguageFile("custom_tesseract_files/custom.traineddata");

using (var input = new OcrInput(@"images\image.png"))
{
    OcrResult result = ocr.Read(input);
    Console.WriteLine(result.Text);
}
Imports IronOcr

Private ocr As New IronTesseract()

ocr.UseCustomTesseractLanguageFile("custom_tesseract_files/custom.traineddata")

Using input = New OcrInput("images\image.png")
	Dim result As OcrResult = ocr.Read(input)
	Console.WriteLine(result.Text)
End Using
VB   C#

多种语言示例

同时使用多种语言。

//PM> Install-Package IronOcr.Languages.Arabic
using IronOcr;

IronTesseract ocr = new IronTesseract();

ocr.Language = OcrLanguage.English;
ocr.AddSecondaryLanguage(OcrLanguage.Arabic);
// Add any number of languages

using (var input = new OcrInput(@"images\multi-lang.pdf"))
{
    var Result = ocr.Read(input);
    Console.WriteLine(Result.Text);
}
//PM> Install-Package IronOcr.Languages.Arabic
using IronOcr;

IronTesseract ocr = new IronTesseract();

ocr.Language = OcrLanguage.English;
ocr.AddSecondaryLanguage(OcrLanguage.Arabic);
// Add any number of languages

using (var input = new OcrInput(@"images\multi-lang.pdf"))
{
    var Result = ocr.Read(input);
    Console.WriteLine(Result.Text);
}
'PM> Install-Package IronOcr.Languages.Arabic
Imports IronOcr

Private ocr As New IronTesseract()

ocr.Language = OcrLanguage.English
ocr.AddSecondaryLanguage(OcrLanguage.Arabic)
' Add any number of languages

Using input = New OcrInput("images\multi-lang.pdf")
	Dim Result = ocr.Read(input)
	Console.WriteLine(Result.Text)
End Using
VB   C#

更快的语言示例

为提高速度而调整的字典。 使用任何 OcrLanguage 的 "快速 "变体。

using IronOcr;

IronTesseract ocr = new IronTesseract();
ocr.Language = OcrLanguage.EnglishFast;

using (var input = new OcrInput(@"images\image.png"))
{
    OcrResult result = ocr.Read(input);
    Console.WriteLine(result.Text);
}
using IronOcr;

IronTesseract ocr = new IronTesseract();
ocr.Language = OcrLanguage.EnglishFast;

using (var input = new OcrInput(@"images\image.png"))
{
    OcrResult result = ocr.Read(input);
    Console.WriteLine(result.Text);
}
Imports IronOcr

Private ocr As New IronTesseract()
ocr.Language = OcrLanguage.EnglishFast

Using input = New OcrInput("images\image.png")
	Dim result As OcrResult = ocr.Read(input)
	Console.WriteLine(result.Text)
End Using
VB   C#

更高精度的详细语言示例

为准确性而调整的字典,但结果更慢。 使用任何 OcrLanguage 的 "最佳 "变体。


//PM> Install-Package IronOcr.Languages.French
using IronOcr;

IronTesseract ocr = new IronTesseract();
ocr.Language = OcrLanguage.FrenchBest;

using (var input = new OcrInput(@"images\image.png"))
{
    OcrResult result = ocr.Read(input);
    Console.WriteLine(result.Text);
}

//PM> Install-Package IronOcr.Languages.French
using IronOcr;

IronTesseract ocr = new IronTesseract();
ocr.Language = OcrLanguage.FrenchBest;

using (var input = new OcrInput(@"images\image.png"))
{
    OcrResult result = ocr.Read(input);
    Console.WriteLine(result.Text);
}
'PM> Install-Package IronOcr.Languages.French
Imports IronOcr

Private ocr As New IronTesseract()
ocr.Language = OcrLanguage.FrenchBest

Using input = New OcrInput("images\image.png")
	Dim result As OcrResult = ocr.Read(input)
	Console.WriteLine(result.Text)
End Using
VB   C#

如何安装 OCR 语言包

其他 OCR 语言包可在下方下载。 两种

  • 安装 NuGet 软件包。 在 NuGet 中搜索 IronOcr 语言.
  • 或者下载 "ocrdata "文件,并将其添加到.NET 项目的任意文件夹中。 设置 CopyToOutputDirectory = CopyIfNewer.

下载 OCR 语言包

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

NuGet

帮助

如果您要阅读的语言不在上述列表中,请 联系我们 请与我们联系。 我们还可应要求提供许多其他语言的服务。

生产资源优先提供给 IronOCR 许可证持有者,因此还请考虑 授权 IronOCR 可访问您所需的语言包。