IronOCRで数式を扱う
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上記の例では、IronOCRはTesseract OCRエンジンを利用して画像ファイルから数式を読み取ります。数式用のカスタム言語パック( equ )が読み込まれることで、検出精度が向上します。 ReadEquationsメソッドは、数式を含む画像へのファイル パスを受け入れ、OCR を実行し、認識されたテキストを出力します。






