Note
This project is a significant upgrade from the original design by Nur Aiman (see Poster.jpg). The previous flow used a basic ESP32-only setup for gate control. This version upgrades the architecture to use Raspberry Pi 5 with Direct ROI OCR for high-speed, intelligent ANPR and automated fee management.
Automatic Number Plate Recognition system using Direct Region of Interest (ROI) OCR. This simplified architecture removes the detection layer (YOLO) to provide faster, more deterministic reading performance on edge devices like the Raspberry Pi 5.
- 🎯 Direct ROI OCR using Tesseract (No YOLO overhead)
- 🔤 Fast text extraction with localized reading zones
- 🚧 Visual Reading Zone monitoring in real-time
- 💾 SQLite database for storing detected plates
- 🖼️ Auto-save plate images with timestamps
- 📊 Statistics dashboard (press 's')
- ⚡ Optimized for Raspberry Pi 5 - 43% faster CPU inference
# 1. Run setup script
bash setup_pi5.sh
# 2. Activate environment
source anpr_env/bin/activate
# 3. Run ANPR
python main.py# Install dependencies
pip install -r requirements.txt
# Install Tesseract OCR from: https://github.com/UB-Mannheim/tesseract/wiki
# Run
python main.pypython main.py # Default camera (index 0)
python main.py --camera 1 # Specific camerapython main.py --image car.jpgpython main.py --export plates.csvThe system features a clickable control bar at the bottom of the window:
| Button | Action |
|---|---|
| CAPTURE | Save the current frame as an image |
| STATS | Print database statistics to the terminal |
| QUIT | Safely shut down the application |
q: Alternative way to quit the application.
ANPR/
├── main.py # Main application
├── plate_detector.py # YOLOv26 detection
├── ocr_reader.py # Tesseract OCR
├── database.py # SQLite storage
├── config.py # Configuration
├── requirements.txt # Dependencies
├── setup_pi5.sh # Pi 5 setup script
└── data/
├── plates.db # Database
└── plates/ # Saved images
Edit config.py to customize:
- Camera resolution
- Confidence threshold
- Display settings
- Save options
| Device | Expected FPS |
|---|---|
| Raspberry Pi 5 | 3-5 FPS |
| Raspberry Pi 5 + Coral USB | 14+ FPS |
| Desktop GPU | 30+ FPS |
MIT License
