使用 IronOCR 的自定义 OCR 语言包

Curtis Chau
Curtis Chau
更新: 2026年7月6日

如何为 IronOCR 创建自定义语言包?

创建自定义语言包需要从字体中训练新的Tesseract 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())
        {
            Input.LoadImage(@"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);
        }
    }
}

Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。

阅读更多

准备开始了吗?

NuGet 下载量 6,394,824版本:2026.11刚刚发布