Sudoku Solver AI with OpenCV
We will be creating a Sudoku Solver AI using python and Open CV to read a Sudoku puzzle from an image and solving it. There a lot of methods to achieve this goal. Thus in this series, I have compiled the best methods I could find/research along with some hacks/tricks I learned along the way.
This article is a part of the series Sudoku Solver AI with OpenCV.
Part 1: Image Processing
Part 2: Sudoku and Cell Extraction
Part 3: Solving the Sudoku
Before and End of Part 2: Left and right respectively
Steps
- Import the image
- Pre Processing the Image
- 2.1** Gaussian blur:** We need to gaussian blur the image to reduce noise in thresholding algorithm
- 2.2 **Thresholding: **Segmenting the regions of the image
- 2.3 Dilating the image: In cases like noise removal, erosion is followed by dilation.
- Sudoku Extraction
- 3.1** Find Contours**
- 3.2** Find Corners: **Using Ramer Doughlas Peucker algorithm / approxPolyDPfor finding corners
- 3.3 **Crop and Warp Image: **We remove all the elements in the image except the sudoku
- 3.4 Extract Cells
- Interpreting the Digits
- 4.1 Import the libraries and load the dataset
- 4.2** Preprocess the data**
- 4.3** Creating the Model**
- 4.4 Predicting the digits
- Solving the Sudoku
#deep-learning #python #sudoku-solver #ai #opencv