Given an image of a sudoku grid, it performs following steps:
- Gaussian Blur to remove noise
- Canny edge detection using Otsu threshold values
- Extraction of largest contour
- Perspective transform (homography) to get top view
- Adaptive thresholding to get binary image
- Extraction of each cell of 9x9 grid
- Using KNN to perform OCR
- Solving the sudoku using backtracking
Note: The images 14,15 work poorly on the Python only versions due to its slow speed and it is not recommended to run those on Python. However, it was resolved by using the C based backend.
Requirements:
OpenCV >= 4.2.0
Instruction on how to use:
make final
./final <path to an image>
Note: the GUI version uses GTK+2.0 which is no longer in use
Requirements:
pip install opencv-python
pip install tkinter
Run gui.py
/ final.py
to launch with / without GUI respectively.
Improved the speed of Python code by integrating C code
Pre-requisites:
cc -fPIC -shared -o c_solver.so c_solver.c
pip install opencv-python
pip install tkinter
Run gui.py
to launch the application
- Use a more sophisticated OCR method
- Add the functionality of generating a Sudoku
- Optimise the Sudoku Solver algorithm by trying variants like dancing links
- Add the option to try out various methods to solve the Sudoku
- Dancing Links
- Best First Search
- Reverse Backtracking
- Spiral Backtracking