Akash Ha
Akash Ha
SUBMITTED BY
SUBMITTED TO:
MADHAVI LATHA
Asst.Professor
1.Abstract
2.Introduction
3.Flow chart
4.Source Code
5.Results
6.Conclusion
ABSTRACT
License Plate Recognition is a computer system that recognizes any digital image automatically
on the number plate. This system includes various operations such as taking pictures, localizing
the number pad, truncating characters and OCR from alphanumeric characters. The main idea
of this system is to design and develop effective image processing techniques and algorithms
to localize the license plate in the captured image, to divide the characters from that number
plate and to identify each character of the segment by using the Open Computer Vision Library.
This has been implemented using python programming language. Many applications can be
implemented by using this system, such as security, highway speed detection, violation of light,
identification of handwritten text, discovery of stolen cars, automatic fee collection systems.
Keywords: Open CV, identifying the vehicle, number plate recognition, OCR(optical
character recognition).
INTRODUCTION
License Plate Recognition or LPR for short, involves three major steps. The steps are as follows
1. License Plate Detection: The first step is to detect the License plate from the car. We will
use the contour option in OpenCV to detect for rectangular objects to find the number plate.
The accuracy can be improved if we know the exact size, color and approximate location of
the number plate. Normally the detection algorithm is trained based on the position of camera
and type of number plate used in that particular country. This gets trickier if the image does
not even have a car, in this case we will an additional step to detect the car and then the license
plate.
2. Character Segmentation: Once we have detected the License Plate we have to crop it out
and save it as a new image. Again this can be done easily using OpenCV.
3. Character Recognition: Now, the new image that we obtained in the previous step is sure
to have some characters (Numbers/Alphabets) written on it. So, we can perform OCR (Optical
Character Recognition) on it to detect the number.
FLOW CHART
SOURCE CODE
import numpy as np
import cv2
import imutils
import sys
import pytesseract
import pandas as pd
import time
image = cv2.imread('car.jpeg')
image = imutils.resize(image,width=500)
cv2.imshow("Original Image",image)
gray = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
gray = cv2.bilateralFilter(gray,11,17,17)
edged = cv2.Canny(gray,170,200)
(new, cnts) =
cv2.findContours(edged.copy(),cv2.RETR_LIST,cv2.CHAIN_APPROX_SIMPLE)
NumberPlateCnt = None
count = 0
for c in cnts:
peri = cv2.arcLength(c,True)
approx = cv2.approxPolyDP(c,0.02*peri,True)
if len(approx) == 4:
NumberPlateCnt = approx
break
mask = np.zeros(gray.shape,np.uint8)
new_image = cv2.drawContours(mask,[NumberPlateCnt],0,255,-1)
new_image = cv2.bitwise_and(image,image,mask=mask)
cv2.namedWindow("Final_image",cv2.WINDOW_NORMAL)
cv2.imshow("Final_image",new_image)
text = pytesseract.image_to_string(new_image,config=config)
df.to_csv('data.csv')
print(text)
cv2.waitKey(0)
RESULTS
INPUT IMAGE
OUTPUT IMAGE
CONCLUSION
The system works satisfactorily for wide variations in illumination conditions and
different types of number plates commonly found in India. It is definitely a better alternative
to the existing proprietary systems, even though there are known restrictions.