Logo Lanfrica

amani-patrick/CarNumber_Plate_detection

Domain:

digital infrastructure

Record type:

software
Creator:
ama
Host:
# Automatic Number Plate Recognition (ANPR) System A lightweight, CPU-friendly Automatic Number Plate Recognition system built with OpenCV and Tesseract OCR. This project implements a complete pipeline for detecting, aligning, reading, and logging vehicle number plates from live camera feed. ## πŸ“‹ Pipeline Overview The system follows a strict three-stage pipeline with additional validation and persistence layers: Camera β†’ Detection β†’ Alignment β†’ OCR β†’ Validation β†’ Temporal Confirmation β†’ CSV Logging ### Pipeline Stages 1. **Detection** (`detect.py`) - Locates plate-like regions using contour analysis and geometric filtering 2. **Alignment** (`align.py`) - Corrects perspective distortion and normalizes plate to fixed size (450Γ—140) 3. **OCR** (`ocr.py`) - Extracts text using Tesseract with character whitelist 4. **Validation** (`validate.py`) - Validates extracted text against Rwanda plate pattern (AAA999A) 5. **Temporal Confirmation** (`temporal.py`) - Confirms plate across multiple frames using majority voting 6. **Logging** - Saves confirmed plates to CSV with timestamps ## πŸš€ Getting Started ### Prerequisites - Python 3.6+ - Tesseract OCR engine - Webcam ### Installation 1. **Clone the repository** ```bash git clone github.com cd CarNumber_Plate_detection ``` 2. **Create and activate virtual environment** ```bash python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate ``` 3. **Install dependencies** ```bash pip install --upgrade pip pip install -r requirements.txt ``` 4. **Install Tesseract OCR** _macOS:_ ```bash brew install tesseract ``` _Ubuntu/Debian:_ ```bash sudo apt update sudo apt install tesseract-ocr ``` _Windows:_ Download from github.com 5. **Verify camera works** ```bash python src/camera.py ``` Press 'q' to quit the camera preview. ## πŸ“ Project Structure ``` anpr-project/ β”‚ β”œβ”€β”€ src/ β”‚ β”œβ”€β”€ camera.py β”‚ β”œβ”€β”€ det …