附加的OCR语言包
IronOCR 支持 125 种国际语言,但只有英语作为标准安装在 IronOCR 中。
可以通过 NuGet 或作为 Dll 下载并添加为项目引用,轻松将其他语言包添加到您的 C#、VB 或 ASP .NET 项目中。
代码示例
国际语言范例
//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
纵向书写语言示例
为垂直书写语言调整的词典。 使用韩语和日语的“垂直”变体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
自定义语言示例
要使用您下载或自行训练的任何 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
多种语言示例
一次使用多种语言。
//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
更快的语言示例
为速度而优化的字典。 使用任何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
更高精度的详细语言示例
字典调整为准确性,但结果速度较慢。 使用任何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
如何安装 OCR 语言包
可下载的其他OCR语言包如下。 任一
- 安装 NuGet 包。 在 NuGet 上搜索 IronOcr Languages。
- 或者下载“ocrdata”文件并将其添加到您的.NET项目中的任意文件夹。设置
CopyToOutputDirectory = CopyIfNewer
下载 OCR 语言包
-
加拿大原住民字母语言包 加拿大原住民Zip NuGet
-
埃塞俄比亚字母语言包 Ge'ezZip NuGet
-
Fraktur Language Pack 通用FrakturZip NuGet
-
Quechua 语言包 Runa SimiZip NuGet
-
Thaana 字母语言包 TaanaZip NuGet
- 约鲁巴语语言包 YorùbáZip NuGet
帮助
如果您要阅读的语言不在上述列表中,请联系我们。 根据要求提供多种其他语言。
优先为 IronOCR 许可持有人提供生产资源,因此请考虑许可 IronOCR,以访问您所需的语言包。