Book Image

Mastering OpenCV Android Application Programming

Book Image

Mastering OpenCV Android Application Programming

Overview of this book

Table of Contents (16 chapters)
Mastering OpenCV Android Application Programming
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
6
Working with Image Alignment and Stitching
Index

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.

Figure 2. Vertical and horizontal lines drawn on a Sudoku grid

The...