Obsługa równań za pomocą IronOCR
Czy IronOCR potrafi czytac rownania?
IronOCR wykorzystuje Tesseract 4/5 i powinien dosc dobrze radzic sobie z odczytywaniem rownan domyslnie, choc warto eksperymentowac ze szczegolowymi opcjami konfiguracji:
Poznaj zmienne konfiguracji Tesseract
Można również dodać niestandardowe pakiety językowe do IronOCR: Dowiedz się o niestandardowych pakietach językowych
Istnieje również pakiet językowy do wykrywania równań EQU: Pakiet 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 ClassW powyzszym przykladzie IronOCR korzysta z silnika OCR Tesseract, aby odczytac rownania z pliku obrazu. Dostosowany pakiet jezykowy do rownan (equ) zostal zaladowany, aby poprawic dokladnosc wykrywania. Metoda ReadEquations przyjmuje sciezke do pliku obrazu zawierajacego rownania, wykonuje OCR i zwraca rozpoznany tekst.
Curtis Chau posiada tytuł licencjata z informatyki (Uniwersytet Carleton) i specjalizuje się w front-endowym rozwoju, z ekspertką w Node.js, TypeScript, JavaScript i React. Pasjonuje się tworzeniem intuicyjnych i estetycznie przyjemnych interfejsów użytkownika, Curtis cieszy się pracą z nowoczesnymi frameworkami i tworzeniem dobrze zorganizowanych, atrakcyjnych wizualnie podręczników.