使用 IronOCR 的自定义 OCR 语言包

Curtis Chau
Curtis Chau
Updated: 2026年6月29日

如何为 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);
        }
    }
}

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

阅读更多

准备开始了吗?

Nuget Downloads 6,357,159版本:2026.11刚刚发布