其他 OCR 語言包
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
垂直書寫語言範例
調整為垂直書寫語言的字典。請使用韓語和日語 OCR 語言的「垂直」變體。
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 的‘Fast’變體。
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 語言包* 或下載 "ocrdata" 文件並將其添加到您的 .NET 專案中的任意文件夾。設置
CopyToOutputDirectory = CopyIfNewer
下載 OCR 語言包
- 加拿大原住民字母語言包 加拿大原住民壓縮
- 埃塞俄比亞字母語言包 格埃茲語壓縮
- Fraktur 語言包 普遍黑体壓縮
- Gurmukhi 字母語言包 古魯穆奇字体壓縮
- Javanese 語言包 爪哇语壓縮
- Quechua 語言包 魯納西米壓縮
幫助
如果您要閱讀的語言不在上面的列表中,請 聯絡我們 與我們聯繫。其他語言可按要求提供。
IronOCR 授權用戶在生產資源上享有優先權,因此請考慮 授權 IronOCR用於訪問您所需的語言包。