Skip to content

knosmos/sudontku

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

su-don't-ku

Lightweight realtime mobile-based computer vision Sudoku solver

Deployed at 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

  • Camera image capture
  • Image preprocessing
  • Board detection and perspective transformation
  • Template-matching digit recognition
  • Sudoku solver
  • Clean UI
  • Image upload
  • Board detection confidence and prompting for manual corner selection