使用 IronOCR 的自定义 OCR 语言包
This article was translated from English: Does it need improvement?
TranslatedView the article in English
如何为 IronOCR 创建自定义语言包?
创建自定义语言包需要从字体训练一个新的 Tesseract 4 LSTM 语言文件/词典。
网上有很多教程讲解了完成此操作所需的步骤。 这个过程并不简单,但好在有详细的文档记录。
作为入门指南,我们建议先观看Gabriel Garcia (与我们无任何关联)的YouTube 教程以及他们链接的GitHub 存储库。
完成后,输出结果将是一个.traineddata文件。
然后,即可按如下方式在 IronOCR 中引用.traineddata文件:
文档: IronOCR 自定义语言
using IronOcr;
class Program
{
static void Main()
{
// Initialize the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Load your custom Tesseract language file (trained .traineddata file)
Ocr.UseCustomTesseractLanguageFile("mydir/custom.traineddata"); //<--- your new font
// Multiple fonts can be used by calling the method multiple times with different files
// Load an image into the OCR Input for processing
using (var Input = new OcrInput(@"images\image.png"))
{
// Perform OCR on the input image
var Result = Ocr.Read(Input);
// Output the recognized text to the console
Console.WriteLine(Result.Text);
}
}
}using IronOcr;
class Program
{
static void Main()
{
// Initialize the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Load your custom Tesseract language file (trained .traineddata file)
Ocr.UseCustomTesseractLanguageFile("mydir/custom.traineddata"); //<--- your new font
// Multiple fonts can be used by calling the method multiple times with different files
// Load an image into the OCR Input for processing
using (var Input = new OcrInput(@"images\image.png"))
{
// Perform OCR on the input image
var Result = Ocr.Read(Input);
// Output the recognized text to the console
Console.WriteLine(Result.Text);
}
}
}$vbLabelText $csharpLabel
准备开始了吗?
Nuget 下载 5,299,091 | 版本: 2025.12 刚刚发布






