tristanfaure.com /projects / ocr-sudoku

OCR Sudoku Solver

Photo → digit recognition → solved puzzle

2025 · ACADEMIC

Stack

C · Neural Networks · Image Processing · Sobel · Canny · Backtracking

Key figures

Language
100% C
Pipeline
3 stages
Grid Cells
81 extracted
NN
From scratch

A complete optical character recognition pipeline that takes a photograph of a sudoku puzzle and outputs the solved grid — entirely written in C from scratch.

Stage 1 — Grid Recognition: analyzes the input image using Sobel and Canny edge detection to identify the 9×9 grid structure. Applies perspective warping to correct skewed photographs, then extracts all 81 individual cells as separate images.

Stage 2 — Digit Classification: a neural network built entirely in C (no external ML library) classifies each extracted cell. The network supports configurable hyperparameters (learning rate, epochs), weight export/import, and includes an XOR proof-of-concept module for validation.

Stage 3 — Solving: a backtracking algorithm systematically tests digit placements against sudoku constraints until finding a valid complete solution.

The project includes dedicated modules for image rotation, flood fill, filtering, and number generation — all hand-implemented in C with no dependencies beyond the standard library.

Links

All 33 projects · Open the interactive portfolio · About Tristan