A high recall Number Plate Detector System in Python and OpenCV
Using Image Processing techniques with the help of Numpy and OpenCV libraries in Python, NumberPlateLocalization is a high recall Number Plate Detector in images of cars.
For using NumberPlateLocalization through the Console, use the following command.
python NumberPlateLocalization.py [options]
The available options are as follows:
The Mode option is used to specify whether you want to write the output images of the application to a folder named FinalOutput. The default mode is None
. To write output images to the HDD, use Write Mode by using --write
.
The Show Steps option is used to show the intermediate steps of the Detector, i.e. the output images of the preprocessing logic of the application. The default mode is False
. To show the intermediate steps, use Show Steps Mode by setting the showsteps flag like so: --showsteps
This is a default option of the Detector application, although it can be used explicitly for code clarity while direct usage in other codebases. Usage: --all
.
The Single Image option is used to specify a single image for the Detector to work on. The required argument for this option is the Image Name(specified along with extension) immediately following the --single
flag. There must be an image of the provided name in the Dataset folder. Example usage is like so: --single FILENAME
The Multi Image option is used to specify a number of images from the Dataset on which the Detector will work. The required argument is a number following the --multi
flag. For a valid number n, the Detector uses the first n images from the dataset. If the number specified exceeds the total images in the Dataset, the Detector defaults to the All Images option. Usage: --multi NUMBER
The options can be used in conjunction to create various combinations. Some examples below:
- Detecting the plates of the first 10 images, and writing the output images to HDD:
python NumberPlateLocalization.py --multi 10 --write
- Detecting the plate from an image named 21.png and showing the intermediate steps, and writing the output to HDD:
python NumberPlateLocalization.py --single 21.png --showsteps --write
The Detector works with fairly accurate results for most of the images in the dataset. Some results are as follows:
However, the Detector fails for some images showing false positives or concave polygons over the Number Plate region.
The Detector results can be improved by using certain Machine Learning optimizations to choose the value of Epsilon for Polygon Approximation, applying a threshold for the Number of White Pixels per total pixels in the area of the detected contour etc.