Skip to main content

Sudoku Wizard 💻🪄

Sudoku Wizard is a Python project that digitizes and solves Sudoku puzzles from images using advanced image processing techniques and OCR (Optical Character Recognition).

Screenshot from 2024-06-18 14-46-34

Features

  • Image Processing: Detects and extracts Sudoku grids from images.
  • OCR and Template Matching: Recognizes digits within the Sudoku grid using either OCR or template matching.
  • Sudoku Solving: Solves the extracted Sudoku puzzle using a DFS algorithm.
  • Visualization: Overlays the solution onto the original image.

Installation

Requires Python 3.10 or newer, on Windows, macOS or Linux.

pip install sudokuwizard          # template matching (light, ~0.5 GB with dependencies)
pip install "sudokuwizard[ocr]"   # also installs EasyOCR + PyTorch for --ocr mode (several GB)

From source

git clone https://github.com/INIGO-7/SudokuWizard.git
cd SudokuWizard
pip install -e ".[ocr]"

Command line

sudokuwizard photo.jpg                 # solve and show the result in a window
sudokuwizard photo.jpg -o solved.png   # also save the solved image
sudokuwizard photo.jpg --no-show -o solved.png   # servers / no display

Usage

Here's a quick example of how to use Sudoku Wizard:

from SudokuWizard import SudokuWizard

# Create a SudokuWizard instance
sw = SudokuWizard()

# Load your sudoku image (works with .jpg, .jpeg, .png and .webp; support for other extensions is unknown)
sw.load_image('image.jpg')

# Run the Sudoku digitalization and resolution process.
# Shows the solution in a window (pass show=False to skip) and returns the solved image.
solved = sw.run()

Project Structure

  • sudoku_wizard.py: Main implementation of the Sudoku Wizard class.
  • sudoku_algorithms.py: Contains various algorithms for solving Sudoku puzzles.
  • exceptions.py: Custom exceptions for error handling.
  • res/photos/: Contains template images for number recognition.
  • pyproject.toml: Packaging metadata and dependencies.

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

License

This project is licensed under the MIT License.


Feel free to reach out if you have any questions or need further assistance!


Enjoy solving Sudoku puzzles with Sudoku Wizard!

🪄

Metadata

Release files for sudokuwizard 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sudokuwizard 0.1.0
File Size Uploaded Provenance Actions
sudokuwizard-0.1.0.tar.gz 68.4 kB Without provenance Details for sudokuwizard-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sudokuwizard 0.1.0
File Interpreter ABI Platform Actions
sudokuwizard-0.1.0-py3-none-any.whl Python 3 none any Details for sudokuwizard-0.1.0-py3-none-any.whl

Total release size: 151.5 kB

Release files / sudokuwizard-0.1.0.tar.gz

Download URL sudokuwizard-0.1.0.tar.gz
Size 68.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c21c1dc0d3e50fca28acf635bb8143c19ce36ef0561ead5c2fe862428314177c
BLAKE2b-256 checksum
How to use checksums
1bbf9abc4dfae01e6b04f1287fa43f29e25501983621dc27eb36e207b671506b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / sudokuwizard-0.1.0-py3-none-any.whl

Download URL sudokuwizard-0.1.0-py3-none-any.whl
Size 83.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3bb323d65c60569ddb099c1f5ac3278fc4ab0db3e450d78561a2e4362ffbc45f
BLAKE2b-256 checksum
How to use checksums
f6e60a9bee7598054378ad7b1b574efd7a3edefe5931232c37a4ea8796f6bcef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Security for sudokuwizard 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page