Sudoku Solver

Solved image of a sudoku grid

This was one of the school projects for EPITA. We had to create an application in C to solve sudoku grids. However, the challenge was not to compute the solution but to extract the grid information from a picture. We weren’t allowed to use any external library so we had to code everything from scratch.

An unsolved sudoku grid Edges of the sudoku grid Detected lines of the sudoku grid

I was in charge of the processing of the image: finding edges, detecting the grid and extracting a flat image. This was a very challenging part because an image can be noisy, blurry, or have a bad contrast and the grid can be rotated, skewed, or have a perspective. With all of that, I had to implement a Canny edge detector, a Hough transform and a perspective correction. It was a lot of thinking, a lot of maths and a lot of trying (I loved it!). In the end, my team members were quite inactive and only did the interface. Thus, I also had to work on the neural network in charge of recognizing the digits. Without any library, the task was actually easier than I thought but I found it fascinating what a bit of maths can do.

solved flat image of the sudoku grid
Sudoku Solver