This repository contains Python scripts for detecting and recognizing number plates using Support Vector Machines (SVM) and Block Binary Pixel Sum descriptors.
The project consists of two main scripts:
train_simple.py
: Trains classifiers for alphabet characters and digits using a dataset of font images.recognize.py
: Uses the trained classifiers to detect and recognize characters in number plates from images.
- Font Image Processing: Converts font images to grayscale and applies thresholding.
- Contour Detection: Identifies and sorts contours in the images.
- Feature Extraction: Uses Block Binary Pixel Sum descriptors to extract features from the regions of interest (ROIs).
- Model Training: Trains SVM classifiers for both alphabet characters and digits.
- Model Serialization: Saves the trained models to disk for later use.
- Number Plate Detection: Detects number plates in images using the trained classifiers.
- Character Recognition: Recognizes and displays characters from detected number plates.
- Clone the repository:
git clone https://github.com/cizodevahm/Number-Plate-Detection.git
- Navigate to the project directory:
cd Number-Plate-Detection
Training the Model
- Prepare your fonts dataset and place it in a directory.
- Run the training script:
python train_simple.py --fonts path/to/fonts --char-classifier output/char_classifier.cpickle --digit-classifier output/digit_classifier.cpickle
- The trained models will be saved in the specified output paths. Recognizing Number Plates
- Place your images in a directory.
- Run the recognition script:
python recognize.py --images path/to/images --char-classifier output/char_classifier.cpickle --digit-classifier output/digit_classifier.cpickle
- The script will display the processed images with detected and recognized number plates.
This project is licensed under the MIT License.