在 IronOCR 中使用阿拉伯数字

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

阿拉伯语、波斯语和乌尔都语语言包无法识别阿拉伯数字?

这是 Tesseract 语言包的一个已知问题。

以下语言包或许有助于解决阿拉伯数字的显示问题: Shreeshrii 的 Tessdata 阿拉伯语

然后可以将其与 IronOCR 功能结合使用,加载自定义语言包: IronOCR 自定义语言示例

using IronOcr;

class ArabicNumeralOCR
{
    static void Main(string[] args)
    {
        // Initialize a new instance of IronTesseract for OCR
        var Ocr = new IronTesseract();

        // Load the custom Tesseract language file for better numeral recognition
        Ocr.UseCustomTesseractLanguageFile("custom_tesseract_files/custom.traineddata");

        // Specify the image input for OCR processing
        using (var Input = new OcrInput(@"images\image.png"))
        {
            // Execute the OCR process on the input image
            var Result = Ocr.Read(Input);

            // Output the recognized text
            Console.WriteLine(Result.Text);
        }
    }
}
using IronOcr;

class ArabicNumeralOCR
{
    static void Main(string[] args)
    {
        // Initialize a new instance of IronTesseract for OCR
        var Ocr = new IronTesseract();

        // Load the custom Tesseract language file for better numeral recognition
        Ocr.UseCustomTesseractLanguageFile("custom_tesseract_files/custom.traineddata");

        // Specify the image input for OCR processing
        using (var Input = new OcrInput(@"images\image.png"))
        {
            // Execute the OCR process on the input image
            var Result = Ocr.Read(Input);

            // Output the recognized text
            Console.WriteLine(Result.Text);
        }
    }
}
Imports IronOcr

Friend Class ArabicNumeralOCR
	Shared Sub Main(ByVal args() As String)
		' Initialize a new instance of IronTesseract for OCR
		Dim Ocr = New IronTesseract()

		' Load the custom Tesseract language file for better numeral recognition
		Ocr.UseCustomTesseractLanguageFile("custom_tesseract_files/custom.traineddata")

		' Specify the image input for OCR processing
		Using Input = New OcrInput("images\image.png")
			' Execute the OCR process on the input image
			Dim Result = Ocr.Read(Input)

			' Output the recognized text
			Console.WriteLine(Result.Text)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel

注意:此 C# 示例演示了如何在 IronOCR 中使用自定义 Tesseract 语言文件来提高图像中阿拉伯数字的识别率。 它假定您已经下载了相应的语言包并将其放置在指定位置。 请务必安装 IronOCR 并在生产代码中添加必要的错误处理。

Curtis Chau
技术作家

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

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

准备开始了吗?
Nuget 下载 5,167,857 | Version: 2025.11 刚刚发布