A Web-based Sudoku Recognizer using Amazon Textract

Alexandra Z Harner
3 min readJul 7, 2020

It is my great pleasure to announce that www.createclassicsudoku.com just added a smart feature to recognize Sudokus in image format (png, jpg, gif, etc).

First, I am going to introduce how you can use this feature on my website. Second, I am going to briefly share the APIs that I have used for this sudoku recognizer. Lastly, the limitations of this Sudoku recognizer will be discussed.

Below are the steps to use our web Sudoku recognizer to identify sudokus in .png, .jpg, .gif, etc. format.

Step 1 — go to www.createclassicsudoku.com

Step 2 — Click “Load” at the bottom of the website. A pop-up window will show up.

Click “Load” at the bottom
Click “Choose File” to Choose A File

Step 3 — Load a Sudoku. In this example, I have tried to load a Sudoku from websudoku.com, a Sudoku from New York Times Sudoku, a Sudoku from 100 Hard Sudokus book (not strictly perpendicular), and a Sudoku from 100 Hard Sudokus Book with both printed numbers and some hand-written numbers as well.

Example 3.1 — Sudoku grabbed from websudoku.com (in .png format)

Sudoku from websudoku.com

Our web Sudoku recognizer identifies the sudoku with 100% accuracy.

Identified Sudoku by our sudoku recognizer (Accuracy: 100%)

Example 3.2 — Sudoku grabbed from the New York Times (in .png format)

Sudoku from the New York Times

Again, our Sudoku recognizer identifies this Sudoku as follows with 100% accuracy.

Identified Sudoku by our sudoku recognizer (Accuracy: 100%)

Example 3.3 — Sudoku photo (in .jpg format) taken by a smartphone from 100 Hard Sudokus book.

Sudoku from 100 Hard Sudokus Book

Our Sudoku recognizer identifies this Sudoku as follows with 92% accuracy (our algorithm did not work that well if the Sudoku is not grabbed strictly vertical).

Identified Sudoku by our Sudoku Recognizer (Accuracy: 92%)

Example 3.4 — Sudoku photo (in .jpg format) taken by a smartphone from 100 Hard Sudoku book with some hand-written numbers.

Sudoku picture with both hand-written numbers and printed numbers

Our Sudoku recognizer identifies the above as the following sudoku with 90% accuracy.

Identified Sudoku by our sudoku recognizer (Accuracy: 90%)

So far, I have shown you how to use our web Sudoku recognizer to identify Sudoku puzzles in png and jpg formats. Our web Sudoku recognizer can identify those strictly vertical Sudoku puzzles with 100% accuracy and identify those not strictly vertical Sudoku puzzles (in .png, .jpg, etc. format) with over 90% accuracy.

The API that I used is Amazon Textract. Once the table (N rows and N columns) and the numbers being recognized, associate the numbers with the table cells, and it is done.

The limitations of our web Sudoku recognizer are that, if the Sudoku is not strictly vertical, the accuracy is compromised. Future work will be done to improve accuracy when the sudoku is not grabbed vertically.

--

--

Alexandra Z Harner

I am a hands-on software consultant who enjoys bringing smiles to people. My site https://www.createclassicsudoku.com ranks 1st when you google “make sudoku”