使用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
技術作家

Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。

除了開發之外,Curtis 對物聯網 (IoT) 有著濃厚的興趣,探索將硬體和軟體結合的創新方式。在閒暇時間,他喜愛遊戲並構建 Discord 機器人,結合科技與創意的樂趣。

準備好開始了嗎?
Nuget 下載 5,556,263 | 版本: 2026.3 剛剛發布
Still Scrolling Icon

還在捲動嗎?

想要快速證明? PM > Install-Package IronOcr
執行範例 觀看您的圖片變成可搜尋的文字。