- Nikunj Patel

Friday, July 10, 2020

License Plate Recognizer with Image Processing in Python AI


Introduction

License Plate Recognizer is used in recognition of vehicle’s number plate by extracting the License plate number as a string from the car image.  It takes vehicle’s image as an input and outputs the characters written on it. It then searches the procured license number in the dummy database and extracts the details of the vehicle’s owner and sends a real time e-mail to them. The entire image processing tasks is extensively carried out with the help of OpenCV Library.


Approach

1.    Pre-processing of image.

2.    Number Plate localization.

3.    Character Segmentation.

4.    Extraction of License Plate Number as string.

5.     Checking dummy database for owner’s detail.

6.    Notifying owner through E-Mail.

 


Pre-processing of Image

The raw input image of vehicle is converted into a gray scaled image. In a grayscale image, each pixel is between 0 & 255. The image is then processed to remove noise and smoothen the image. Canny edge Detection is applied on the resultant image to find sharp boundaries or edges and to get structure of various objects.



Number Plate Localization

This is probably the most important stage of the application. It is this stage that the region of the license plate is recognized. The input at this stage is the preprocessed image and the output is only the license plate region from the whole image. Contour detection technique is used for plate localization.  contour is a closed curve joining all the continuous points having some color or intensity. We use “findContour()” of the OpenCV library to detect contours in the edged image and then check if that contour  is a probable number plate like object . Thus we finally obtain the number plate.



 Character Segmentation

On the above number plate image we again apply pre-processing methods and contour detection approach to segment individual character of the License Number. We apply morphological image processing techniques like thresholding, erosion and dilation to distinguish individual characters from its surrounding more precisely.

  




 

Extraction of License Plate Number

The Pytesseract library is an open source optical character recognition tool for python. It is used to convert image text into a string.

The localized number plate image is passed to the tesseract function to obtain the license number as string. The resultant string is checked for blank spaces or any other characters which are not part of the license number and the final License Plate Number is obtained.



 

Checking Dummy Database

 A dummy database is created in MySQL having owner details like name, License Number, email address, phone number, address, etc.

MySQL connector is used to establish a connection between MySQL and Python. It is used to fetch email address of the vehicle’s owner with the help of license plate number of the vehicle.

 

Notifying owner through E-Mail

As we now have the owner’s email address we use the SMTP library. The smtplib module defines an SMTP client session object that can be used to send mail to any Internet machine. Thus an email is sent successfully to the owner.

 



Example:









No comments:

Post a Comment