使用 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 下載 6,136,090 | 版本: 2026.7 剛剛發布

