https://github.com/aakashjhawar/solvesudoku
Extract and solve sudoku from an image using Computer Vision and Deep Learning
https://github.com/aakashjhawar/solvesudoku
cnn cnn-classification cnn-tensorflow convolutional-neural-networks cv2 deep-learning digital-image-processing handwritten-digit-recognition image-processing image-segmentation machine-learning neural-network opencv opencv-python python sudoku sudoku-grabber sudoku-scanner sudoku-solution-finder sudoku-solver
Last synced: 4 months ago
JSON representation
Extract and solve sudoku from an image using Computer Vision and Deep Learning
- Host: GitHub
- URL: https://github.com/aakashjhawar/solvesudoku
- Owner: aakashjhawar
- License: mit
- Created: 2018-12-19T14:28:13.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-10-01T12:28:24.000Z (about 5 years ago)
- Last Synced: 2025-04-19T07:13:12.688Z (8 months ago)
- Topics: cnn, cnn-classification, cnn-tensorflow, convolutional-neural-networks, cv2, deep-learning, digital-image-processing, handwritten-digit-recognition, image-processing, image-segmentation, machine-learning, neural-network, opencv, opencv-python, python, sudoku, sudoku-grabber, sudoku-scanner, sudoku-solution-finder, sudoku-solver
- Language: Python
- Homepage:
- Size: 1.16 MB
- Stars: 59
- Watchers: 1
- Forks: 30
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://forthebadge.com)
# SolveSudoku
SolveSudoku extract and solve sudoku from image. It uses a collection of image processing techniques and Convolution Neural Network for training and recognition of characters.
CNN is trained on MNIST dataset to detect digits.
## Blog
Checkout the **articles on SolveSudoku** on Medium.com
[Sudoku Solver using OpenCV and DL — Part 1](https://medium.com/@aakashjhawar/sudoku-solver-using-opencv-and-dl-part-1-490f08701179)
[Sudoku Solver using OpenCV and DL — Part 2](https://medium.com/@aakashjhawar/sudoku-solver-using-opencv-and-dl-part-2-bbe0e6ac87c5)
## Getting Started
How to use
```
git clone https://github.com/aakashjhawar/SolveSudoku.git
cd SolveSudoku
python3 sudoku.py
```
## Prerequisites
- Python 3.5
- OpenCV
```
sudo apt-get install python-opencv
```
## Procedure
> 1. Image preprocessing (Thresholding).
> 2. Find the largest contour (sudoku square).
> 3. Get the cordinates of **largest contour**.
> 4. Crop the image.
> 5. Perform **Warp perspective** on image
> 5. Extract each cells from the image by slicing the sudoku grid.
> 6. Extract the **largest component** in the sudoku image (number).
> 7. Remove noise in block.
> 8. Send the number to pre trained Digit Recogition model.
> 9. Send the grid to Sudoku Solver to perform the final step.
## Working
#### Input image of Sudoku-

#### Image of Sudoku after thresholding-

#### Contour corners of Sudoku-

#### Warp Image-

#### Final output of ExtractSudoku-

#### Extracted grid-

#### Solved grid-
