A Python-based OCR API for extracting 4×4 tile values from 2048 game screenshots using OpenCV and Tesseract. It includes a FastAPI backend and a browser-based HTML frontend.
- Python 3.9+
- A modern web browser (for the frontend)
- Tesseract OCR installed and available in your system path
Install dependencies:
pip install -r requirements.txtStart the FastAPI backend:
uvicorn ocr_api:app --reloadServe index.html with a simple HTTP server:
python -m http.serverThen open the page in your browser.
Upload a screenshot of the 2048 game using the browser interface served by index.html.
| Input | Output |
![]() |
|
.
├── index.html # Frontend interface
├── ocr_api.py # FastAPI backend
├── requirements.txt # Python dependencies
- FastAPI — backend framework
- OpenCV-Python — board detection and image processing
- pytesseract — Python wrapper for Tesseract OCR
- Tesseract OCR — text recognition engine
- Python Imaging Library (Pillow) — image format handling
