Supplementary images files for this homework are also posted on the class website.

Part 0

Use basic morphological operations to produce two images: one containing just the grid and one containing just the numbers. Solve this problem using both MATLAB and OpenCV.

Matlab

Original

Grid

Numbers

Source
% Insert your code here

OpenCV

Original

Grid

Numbers

Source
// Insert your code here

Part 1

Write a program that can find the individual cells in an empty Sudoku grid. The program should highlight the cells, e.g., by filling them with different colors. If you can do the last image you’ll get some extra credit. Solve this and all subsequent problems using either MATLAB or OpenCV.

1_Grid/SudokuGrid1.jpg

1_Grid/SudokuGrid2.jpg

1_Grid/SudokuGrid3.jpg

output/placeholder.jpg

output/placeholder.jpg

output/placeholder.jpg

Source
// Insert your code here

Part 2

Extend your program to find the locations of all the numbers in the puzzle. Highlight the numbers in red in the result images. Also print the puzzle on the screen using ASCII characters. There are computer-generated images that don’t have any noise.

2_Computer_Generated/sudoku1.jpg

2_Computer_Generated/sudoku2.jpg

2_Computer_Generated/sudoku3.jpg

output/placeholder.jpg

output/placeholder.jpg

output/placeholder.jpg

Source
// Insert your code here

Part 3

This is similar to part 2 but these are scanned images that contain noise. You can crop small images for each digit and use them to create matching templates that your program can use to find the digits. (You can do this in part 2 as well).

3_Scanned/ScannedPuzzle1.jpg

3_Scanned/ScannedPuzzle2.jpg

3_Scanned/ScannedPuzzle3.jpg

output/placeholder.jpg

output/placeholder.jpg

output/placeholder.jpg

Source
// Insert your code here

Part 4

This is the same as part 3 but the font is different. You may have to generate new matching templates.

4_Scanned2/scanned1.jpg

4_Scanned2/scanned2.jpg

4_Scanned2/scanned3.jpg

output/placeholder.jpg

output/placeholder.jpg

output/placeholder.jpg

Source
// Insert your code here

Extra Credit

Extend your code to solve the puzzle and print its solution.

Special Extra Credit: Write an application that can take in a picture of the daily Sudoku puzzle from your favorite newspaper and print the solution. (iPhone app anyone?)