Solving a Sudoku puzzle
Remember the Sudoku puzzle project in Chapter 2, Detecting Basic Features in Images? Now is the perfect time to revisit this project and see whether we can use anything that we learnt in this chapter to complete this application. So, in Chapter 2, Detecting Basic Features in Images, we had successfully detected the Sudoku puzzle. Only two things were left in that application: recognizing digits and solving the Sudoku puzzle.
Recognizing digits in the puzzle
Let's pick up from where we left in Chapter 2, Detecting Basic Features in Images. After detecting the grid successfully, we need to further break down the grid into 81 small squares. There are many possible ways of doing this, but here, we will look at only three techniques.
First, the easiest of all is to draw nine equally spaced vertical and horizontal lines each on the image, and assume the digits to be placed within the boxes made by these lines.
The...