GithubHelp home page GithubHelp logo

aakashjhawar / solvesudoku Goto Github PK

View Code? Open in Web Editor NEW
54.0 2.0 30.0 1.19 MB

Extract and solve sudoku from an image using Computer Vision and Deep Learning

License: MIT License

Python 99.17% HTML 0.83%
sudoku-solver python deep-learning opencv opencv-python sudoku image-processing image-segmentation cnn machine-learning

solvesudoku's Introduction

forthebadge

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

Getting Started

How to use

git clone https://github.com/aakashjhawar/SolveSudoku.git
cd SolveSudoku
python3 sudoku.py <path/to/input_image>

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

solvesudoku's People

Contributors

aakashjhawar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

solvesudoku's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.