SudokuWizard
Point a camera at a Sudoku, get it back solved, in the same photo.
The idea
It started as a university project at Deusto and turned into the thing I actually wanted it to be once I found out that publishing to PyPI is open to anyone. So I packaged it properly and put it out there:
pip install sudokuwizard
It remains my only published open-source package — a piece of software a complete stranger can install and run without ever talking to me.
The pipeline
There is no single model doing the work here. It is a chain of classical computer vision steps, and each one has to hold:
- Find the grid. Locate the Sudoku in an arbitrary photograph and rectify it, correcting for whatever angle the picture was taken at.
- Segment the cells. Split the rectified grid into its 81 cells.
- Read the digits. Two interchangeable recognition paths — OCR, or template matching against a reference set of digit images shipped with the package.
- Solve. A depth-first backtracking search over the recovered board.
- Draw it back. Project the solution onto the original photograph, in place.
The hard part
Step 3, and it is not close. OCR engines are trained on words and lines of text; they are unreliable on small, noisy, single-character crops, which is exactly what 81 Sudoku cells are. And the failure is unforgiving — a single misread digit does not degrade the answer, it poisons the constraint search and you get back a board that is confidently wrong.
The pragmatic answer was to make recognition pluggable rather than to pick a winner. Template matching against a shipped reference set is dumber than OCR and, on this particular input distribution, frequently better. Having both means you can fall back when one of them is having a bad day.
Notes
MIT licensed, dependency spec and conda environment included, no active development since. It does what it says.