Skip to content

Code for a LEGO EV3 robot that scans and solves sudoku puzzles using a webcam, then prints its answers

License

Notifications You must be signed in to change notification settings

nathanchrs/sudokuscanner

Repository files navigation

Sudoku Scanner

Program for an EV3 robot that reads a sudoku puzzle using a webcam and solves them.

By nathanchrs.

Modules

  • sudokuscanner.py: main program, run this program from EV3.
  • sudokusolver.py: sudoku puzzle checker and solver logic.
  • sudokucapture.py: reads a sudoku puzzle from an image.
  • opencv_functions.py: contains miscellaneous image processing functions from the OpenCV 2.4.12 Python 2 samples (common.py and digits.py).
  • digitcapture.py: reads free-standing digits from an image (currently the image must be clean and only contain the numbers).

Sample usage can be found by running each module directly.

Training Data

Training data for each dataset consists of 2 numpy .npy files:

  • samples.npy: contains a numpy float32 array of 20x20 px images.
  • labels.npy: contains a numpy array of integers corresponding to each image in the samples file.

These files are placed in the data/[DATASET_NAME]/ directory.

Currently there are 2 available datasets:

  • sudoku_digits: sans-serif 1-9 digits
  • handwritten_digits: handwritten 0-9 digits, generated from MNIST samples (see Credits).

There are trainer programs to help generate datasets:

  • train_sudoku_digits.py: uses data from sudoku images captured through a webcam, manually labelled by the user.
  • train_handwritten_digits.py: uses data from a training image (data/handwritten_digits/handwritten_digits.png).

Credits

This project uses the following open source components:

Handwritten digit training uses samples from MNIST: http://yann.lecun.com/exdb/mnist/

Sudoku digit samples uses sudoku puzzle images from Google Image Search.

References

About

Code for a LEGO EV3 robot that scans and solves sudoku puzzles using a webcam, then prints its answers

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages