Using Custom OCR Language Packs with IronOCR

This article was translated from English: Does it need improvement?
Translated
View the article in English

如何创建用于 IronOCR 的自定义语言包? 创建自定义语言包需要从字体中训练一个新的 Tesseract 4 LSTM 语言文件/词典。 网上有很多教程,解释了翻译所需的步骤。 这个过程并不简单,但值得庆幸的是,它有相当完善的文档。 As a good place to start, we suggest this [YouTube tutorial](https://www.youtube.com/watch?v=KE4xEzFGSU8) from [Gabriel Garcia](https://www.youtube.com/c/GabrielGarciaGG) (no affiliation) and their linked [GitHub repository](https://github.com/astutejoe/tesseract_tutorial). 翻译完成后,输出将是一个 `.traineddata` 文件。 这样,`.traineddata` 文件就可以在 IronOCR 中以如下方式引用: 文档:[IronOCR 自定义语言](https://ironsoftware.com/csharp/ocr/languages/) ```csharp 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
技术作家

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

除了开发之外,Curtis 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。

准备开始了吗?
Nuget 下载 5,044,537 | 版本: 2025.11 刚刚发布