All work
OCR Math Solver
2022·Sole engineer·shipped

OCR Math Solver

A computer vision pipeline that reads handwritten mathematical expressions from images and solves them step-by-step. Combines OpenCV image preprocessing, Tesseract OCR for character recognition, and SymPy for symbolic computation.

Problem

Students solving math problems by hand have no quick way to verify their work. Typing expressions into a calculator is slow and error-prone. A system that reads handwritten math directly from a photo and produces step-by-step solutions bridges that gap.

Solution

OpenCV pipeline preprocesses input images: grayscale conversion, adaptive thresholding, morphological operations to isolate expression regions. Tesseract OCR extracts the mathematical text. SymPy parses and solves the expression symbolically, generating a step-by-step solution breakdown.

Architecture

Preprocessing

OpenCV pipeline: grayscale conversion, Gaussian blur, adaptive thresholding, dilation/erosion to clean handwritten strokes and isolate expression bounding boxes.

OCR

Tesseract OCR (custom config for math characters) extracts the expression string from preprocessed image regions.

Parsing & solving

SymPy parses the OCR output into a symbolic expression tree and solves it — supporting arithmetic, algebra, and basic calculus.

Output

Step-by-step solution displayed with intermediate simplification steps, final answer, and annotated image showing detected expression region.

Highlights

  • OpenCV adaptive thresholding and morphological ops for handwriting cleanup.
  • Tesseract OCR with custom config tuned for mathematical character sets.
  • SymPy symbolic computation — supports algebra, arithmetic, and basic calculus.
  • Step-by-step solution output with intermediate simplification steps.