Skip to content

pulkitbajaj1999/sudoku-backend

Repository files navigation

based on SolveSudoku

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

Sudoku Solver using OpenCV and DL — Part 2

Prerequisites

  • Python 3.5 or above
  • OpenCV
  • tensorflow

Getting Started

How to use

  1. clone the repo
git clone https://github.com/aakashjhawar/SolveSudoku.git
  1. set up python virtual environment in the repo
  2. install the requirements2.txt
pip install -r requirement2.txt
  1. train the model specific to your system
python cnn_model1.py
  1. run djnago server
python manage.py runserver 0.0.0.0:8000
  1. checkout frontend repo
https://github.com/pulkitbajaj1999/sudoku-frontend.git
  1. after starting both fronend and backend got to browser and open frontend

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
  6. Extract each cells from the image by slicing the sudoku grid.
  7. Extract the largest component in the sudoku image (number).
  8. Remove noise in block.
  9. Send the number to pre trained Digit Recogition model.
  10. Send the grid to Sudoku Solver to perform the final step.

Working

Input image of Sudoku-

Input image of sudoku

Image of Sudoku after thresholding-

Threshold image of sudoku

Contour corners of Sudoku-

Contour of sudoku

Warp Image-

Warp of sudoku

Final output of ExtractSudoku-

Final image of sudoku

Extracted grid-

extracted grid

Solved grid-

Solved grid

About

django

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages