Sudoku Ocr
About
sudoku-ocr is a package that deliver class and methods to ocr sudoku image
Getting started
Installation
pip install sudoku-ocr
Usage example
from sudoku_ocr import Board
board = Board()
board.prepare_img("/path/to/sudoku/image")
board.ocr_sudoku()
print(board.board_value)
# [[0 0 7 0 0 4 0 0 9]
# [0 0 0 0 0 0 0 1 5]
# [4 0 0 3 5 8 0 0 7]
# [1 0 0 2 0 0 3 0 6]
# [0 5 0 0 3 0 0 7 2]
# [0 0 3 0 0 1 0 0 8]
# [0 0 0 8 9 3 0 0 4]
# [0 7 0 0 0 0 0 0 3]
# [3 0 0 7 0 0 5 0 1]]
board.solve()
print(board.solved_board)
# [[5 6 7 1 2 4 8 3 9]
# [8 3 2 9 7 6 4 1 5]
# [4 9 1 3 5 8 6 2 7]
# [1 4 9 2 8 7 3 5 6]
# [6 5 8 4 3 9 1 7 2]
# [7 2 3 5 6 1 9 4 8]
# [2 1 5 8 9 3 7 6 4]
# [9 7 4 6 1 5 2 8 3]
# [3 8 6 7 4 2 5 9 1]]
User have access to public properties:
board_value- sudoku image representation as 2D arraysolved_board- solved board_value. In case board_value is invalid, solved_board will be 2D array filled with 0.
Usage without ocr
In case user just wants to solve sudoku, without need to ocr it first or ocr is incorrect.
It is possible to set board_value as 2D array directly and than call solve() e.g.
board = Board()
board.board_value = [
[0, 0, 7, 0, 0, 4, 0, 0, 9],
[0, 0, 0, 0, 0, 0, 0, 1, 5],
[4, 0, 0, 3, 5, 8, 0, 0, 7],
[1, 0, 0, 2, 0, 0, 3, 0, 6],
[0, 5, 0, 0, 3, 0, 0, 7, 2],
[0, 0, 3, 0, 0, 1, 0, 0, 8],
[0, 0, 0, 8, 9, 3, 0, 0, 4],
[0, 7, 0, 0, 0, 0, 0, 0, 3],
[3, 0, 0, 7, 0, 0, 5, 0, 1],
]
board.solve()
print(board.solved_board)
# [[5 6 7 1 2 4 8 3 9]
# [8 3 2 9 7 6 4 1 5]
# [4 9 1 3 5 8 6 2 7]
# [1 4 9 2 8 7 3 5 6]
# [6 5 8 4 3 9 1 7 2]
# [7 2 3 5 6 1 9 4 8]
# [2 1 5 8 9 3 7 6 4]
# [9 7 4 6 1 5 2 8 3]
# [3 8 6 7 4 2 5 9 1]]
Metadata
Release files for sudoku-ocr 1.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sudoku_ocr-1.1.3-py3-none-any.whl | Python 3 | none | any | Details for sudoku_ocr-1.1.3-py3-none-any.whl |
Release files / sudoku_ocr-1.1.3-py3-none-any.whl
| Download URL | sudoku_ocr-1.1.3-py3-none-any.whl |
|---|---|
| Size | 5.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
64fcd7362c41d2ade19ef941ac13617e052ed47b372d1ac8e9a51c701829fb7d
|
|
BLAKE2b-256 checksum How to use checksums |
e9f763f8b904f0d8b3ebd6e33ea2589996a54dc5e0f8d4134b1a97114e5442eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.2.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.12
|
Security for sudoku-ocr 1.1.3
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.