Handling Equations with IronOCR

Can IronOCR read equations?

IronOCR uses Tesseract 4/5 and should work quite well with reading equations out of the box, though you may want to experiment with the detailed configuration options:

Explore Tesseract Configuration Variables

You may also add custom language packs to IronOCR: Learn about custom language packs

There is also an EQU Equation Detection Language Pack: EQU Language Pack

// 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

In the example above, IronOCR utilizes the Tesseract OCR engine to read equations from an image file. The custom language pack for equations (equ) is loaded to improve detection accuracy. The ReadEquations method accepts a file path to the image containing equations, performs OCR, and outputs the recognized text.