使用 IronOCR 處理方程式
Curtis Chau
已更新: 2026年7月6日
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 = OcrLanguage.Custom;
Ocr.UseCustomTesseractLanguageFile("equ.traineddata");
// Read and OCR the image containing equations
using (var Input = new OcrInput())
{
Input.LoadImage(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);
}
}
}' VB Example to demonstrate reading equations using IronOCR
Imports IronOcr ' Import the IronOcr namespace
Public Class EquationOcrExample
Public Sub ReadEquations(imagePath As String)
' Instantiate the IronTesseract object
Dim Ocr As New IronTesseract()
' Load the custom EQU language for better equation detection
Ocr.Language = OcrLanguage.Custom
Ocr.UseCustomTesseractLanguageFile("equ.traineddata")
' Read and OCR the image containing equations
Using Input As New OcrInput()
Input.LoadImage(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' VB Example to demonstrate reading equations using IronOCR
Imports IronOcr ' Import the IronOcr namespace
Public Class EquationOcrExample
Public Sub ReadEquations(imagePath As String)
' Instantiate the IronTesseract object
Dim Ocr As New IronTesseract()
' Load the custom EQU language for better equation detection
Ocr.Language = OcrLanguage.Custom
Ocr.UseCustomTesseractLanguageFile("equ.traineddata")
' Read and OCR the image containing equations
Using Input As New OcrInput()
Input.LoadImage(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在上面的範例中,IronOCR使用Tesseract OCR引擎從圖像文件讀取方程式。 方程式的自定義語言包 (equ) 已加載以提高檢測準確性。 ReadEquations 方法接受包含方程的圖像的文件路徑,執行OCR操作,並輸出識別出的文本。
Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。