使用 IronOCR 處理方程式

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

IronOCR 能讀取方程式嗎?

IronOCR 使用 Tesseract 4/5,開箱即用,讀取方程式的效果應該相當不錯,不過您可能需要嘗試更詳細的設定選項:

探索 Tesseract 配置變數

您也可以為 IronOCR 新增自訂語言套件:了解自訂語言套件

此外,還有一個 EQU 方程式偵測語言包: EQU 語言包

// C# Example to demonstrate reading equations using IronOCR

using IronOcr; // Import the IronOcr namespace

public class EquationOcrExample
{
    public void ReadEquations(string imagePath)
    {
        // Instantiate the IronTesseract object
        var Ocr = new IronTesseract();

        // Load the custom EQU language for better equation detection
        Ocr.Language = Ocr.Languages.Add("equ");

        // Read and OCR the image containing equations
        using (var Input = new OcrInput(imagePath))
        {
            // Extract OcrResult from the image
            var Result = Ocr.Read(Input);

            // Output the contents of the OCR result as text
            System.Console.WriteLine(Result.Text);
        }
    }
}
// C# Example to demonstrate reading equations using IronOCR

using IronOcr; // Import the IronOcr namespace

public class EquationOcrExample
{
    public void ReadEquations(string imagePath)
    {
        // Instantiate the IronTesseract object
        var Ocr = new IronTesseract();

        // Load the custom EQU language for better equation detection
        Ocr.Language = Ocr.Languages.Add("equ");

        // Read and OCR the image containing equations
        using (var Input = new OcrInput(imagePath))
        {
            // Extract OcrResult from the image
            var Result = Ocr.Read(Input);

            // Output the contents of the OCR result as text
            System.Console.WriteLine(Result.Text);
        }
    }
}
$vbLabelText   $csharpLabel

在上面的範例中,IronOCR 使用 Tesseract OCR 引擎從影像檔案中讀取方程式。為了提高識別精度,載入了自訂的方程式語言包 ( equ )。 ReadEquations方法接受包含方程式的圖像的檔案路徑,執行 OCR,並輸出識別出的文字。

柯蒂斯·週
技術撰稿人

Curtis Chau擁有卡爾頓大學電腦科學學士學位,專長於前端開發,精通Node.js、TypeScript、JavaScript和React。他熱衷於打造直覺美觀的使用者介面,喜歡使用現代框架,並擅長撰寫結構清晰、視覺效果出色的使用者手冊。

除了開發工作之外,柯蒂斯對物聯網 (IoT) 也抱有濃厚的興趣,致力於探索硬體和軟體整合的創新方法。閒暇時,他喜歡玩遊戲和製作 Discord 機器人,將他對科技的熱愛與創造力結合。

準備好開始了嗎?
Nuget 下載 5,299,091 | 版本: 2025.12 剛剛發布