使用 IronOCR 處理數學公式
This article was translated from English: Does it need improvement?
Translated
View the article in English
IronOCR 能否讀取數學公式?
IronOCR 採用 Tesseract 4/5,開箱即用即可流暢讀取數學公式,不過您可能需要嘗試調整詳細的設定選項:
您亦可為 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);
}
}
}
' C# Example to demonstrate reading equations using IronOCR
Imports IronOcr ' Import the IronOcr namespace
Public Class EquationOcrExample
Public Sub ReadEquations(ByVal imagePath As String)
' Instantiate the IronTesseract object
Dim 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 Input = New OcrInput(imagePath)
' Extract OcrResult from the image
Dim Result = Ocr.Read(Input)
' Output the contents of the OCR result as text
System.Console.WriteLine(Result.Text)
End Using
End Sub
End Class
$vbLabelText
$csharpLabel
在上述範例中,IronOCR 運用 Tesseract OCR 引擎從影像檔案中讀取方程式。系統會載入專用的方程式語言套件 (equ),以提升辨識準確度。 ReadEquations 方法接受包含方程式的圖片檔案路徑,執行 OCR 處理,並輸出辨識出的文字。
準備開始了嗎?
Nuget 下載 5,896,332 | 版本: 2026.5 just released

