A web-based application to recognize, generate, and solve Sudoku puzzles using image processing (OCR), Backtracking algorithms, and Flask for the backend API. Users can upload an image of a Sudoku puzzle, generate new puzzles of varying difficulty, or solve manually entered ones.
- β Upload a Sudoku image and auto-recognize the grid using OpenCV and Tesseract OCR
- β
Generate valid Sudoku puzzles (
easy,medium,hard) - β Solve any valid Sudoku grid using a backtracking algorithm
- β Clean and modular backend using Flask
- Backend: Python, Flask
- Image Processing: OpenCV, Pytesseract, PIL (Pillow)
- Sudoku Logic: Numpy-based grid manipulation, AI solver & generator
- Frontend: HTML/CSS/JavaScript
βββ app.py # Flask main application
βββ recognizer.py # Handles OCR and Sudoku grid recognition from images
βββ solver.py # Sudoku solver using backtracking
βββ generator.py # Sudoku puzzle generator with difficulty levels
βββ templates/ # HTML templates (e.g., index.html)
βββ static/
β βββ styles/ # CSS files
β βββ scripts/ # JavaScript files
βββ uploads/ # Temporary upload folder (auto-created)
βββ requirements.txt # Python dependencies
βββ README.md # You're here
Ensure you have Python 3.7+ installed.
You also need Tesseract-OCR installed on your system:
- Download from: https://github.com/tesseract-ocr/tesseract
- After installation, optionally configure the path in
recognizer.py:
# pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'sudo apt update
sudo apt install tesseract-ocrpython -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activatepip install -r requirements.txtpython app.pyThen visit: http://127.0.0.1:5000
Flask
numpy
opencv-python
pytesseract
Pillow
- Add support for mobile camera capture
- Improve OCR digit recognition with CNN
- Track solving steps visually
This project is open-source and available under the MIT License.
Made with π§ , π, and β€οΈ for Sudoku enthusiasts!