https://github.com/knosmos/sudontku
Browser-based OCR sudoku solver
https://github.com/knosmos/sudontku
computer-vision opencv sudoku-solver
Last synced: 5 months ago
JSON representation
Browser-based OCR sudoku solver
- Host: GitHub
- URL: https://github.com/knosmos/sudontku
- Owner: knosmos
- Created: 2024-03-07T06:27:07.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-01-01T20:28:32.000Z (over 1 year ago)
- Last Synced: 2025-03-24T22:22:34.797Z (over 1 year ago)
- Topics: computer-vision, opencv, sudoku-solver
- Language: JavaScript
- Homepage:
- Size: 4.01 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# su-don't-ku
Lightweight realtime mobile-based computer vision Sudoku solver

Deployed at [https://knosmos.github.io/sudontku/](https://knosmos.github.io/sudontku/)
## How does it work?
Starting with the raw camera feed, Otsu's adaptive thresholding gives us a binary black-and-white image. After some more preprocessing to clean up the image, we run contour detection and polygon approximation to find candidate board boundary points. We look for the largest square-shaped contour (four edges that are roughly equal in length), and run a homography to correct the perspective distortion. From here, we can split the board into its 81 cells and individually run digit recognition on each of them; this is implemented with template matching. The last step is the easiest: a backtracking algorithm takes the detected board and solves the Sudoku.
## Why?
My friend is too good at Sudoku. She beat me ten times in a row, so I figured I would try to level the playing field :)
## Roadmap
- [x] Camera image capture
- [x] Image preprocessing
- [x] Board detection and perspective transformation
- [x] Template-matching digit recognition
- [x] Sudoku solver
- [x] Clean UI
- [ ] Image upload
- [ ] Board detection confidence and prompting for manual corner selection