Converter Imagem em Texto de Equações Matemáticas com IronOCR
O IronOCR consegue realizar leitura de texto de equações?
O IronOCR utiliza o Tesseract 4/5 e deve funcionar muito bem na leitura de equações sem necessidade de configurações adicionais, embora você possa querer experimentar as opções de configuração detalhadas:
Explore as variáveis de configuração do Tesseract
Você também pode adicionar pacotes de idiomas personalizados ao IronOCR: Saiba mais sobre pacotes de idiomas personalizados
Existe também um pacote de idiomas para detecção de equações EQU: Pacote de idiomas 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
No exemplo acima, IronOCR utiliza o mecanismo Tesseract OCR para ler equações de um arquivo de imagem. O pacote de idioma personalizado para equações (equ) é carregado para melhorar a precisão da detecção. O método ReadEquations aceita um caminho de arquivo para a imagem contendo equações, realiza OCR e produz o texto reconhecido.

