LPR Q
LPR Q
The main objective of License Plate Detection project is to reduce the criminal
activity like stolen vehicle, road traffic monitoring that involve use of motor vehicles. In
this project we will be processing the image of the vehicle such that the vehicle number
from the image will be extracted. This report discuses a method for the vehicle number
plate recognition from the image using mathematical morphological operations. The main
objective is to use different morphological operations in such a way that the number plate
of vehicle can be identified accurately. This is based on various operation such as image
enhancement, morphological transformation, edge detection and extraction of number
plate from vehicle image. After this segmentation is applied to recognize the characters
present on number plate.
CHAPTER 1
INTRODUCTION
In License plate recognition, a camera captures the vehicle images and a computer
processes them and recognizes the information on the number plate by applying various
image processing and optical character recognition techniques. Prior to the character
recognition, the number plates must be separated from the background images. This task
is considered as the most crucial step in the License plate recognition system, which
influences the overall accuracy and processing speed of the whole system significantly.
Since there are problems such as poor image quality, image perspective distortion, other
disturbance characters or reflection on vehicle surface, and the color similarity between
the number plate and the background vehicle body, the number plate is often difficult to
be located accurately and efficiently.
Generally vehicle number plate recognition is divided into several steps including
number plate extraction,image region which contains a number plate, character
segmentation, and character recognition. Generally, in order to recognize a vehicle
number plate, the region of the number plate should be extracted from a vehicle image.
Accurate detection of the plate region is essential process to go over to the step of
character recognition.
Summary:
In this paper an attempt has been made to develop an automatic number plate
detection and recognition system for Indian vehicles. The proposed system first detects
the vehicle and then captures the vehicle image. Vehicle number plate region is extracted
using the image segmentation and characters are recognized using optical character
recognition technique. The system can handle noisy, low illuminated, cross angled, non-
standard font number plates. The morphological transformation, Gaussian smoothing, and
Gaussian thresholding the different image processing techniques, has been used in the
pre-processing stage. The contours have been applied by border following and contours
are filtered based on character dimensions and spatial localization for number plate
segmentation and then for character recognition K-nearest neighbour algorithm has been
used. The proposed system has good accuracy and can be used for e-challan surveillance,
stolen vehicle detection and many other applications.
PAPER 2:
Title: "Vehicle number plate detection using image processing",Singh, Abhay, Anand
Kumar Gupta, Anmol Singh, Anuj Gupta, and Sherish Johri. International Research
Journal of Engineering and Technology (IRJET) 5, no. 03 (2018).
Summary:
In this technology we will be working on input images given. The These input
images are converted to grayscale and characters are segmented and recognised using
OCR. There are some conditions for this software to work:
1) Vehicle plates should be white and according to the rules given by the government of
India.
2) Image should be of appropriate brightness and contrast: In this, a software is designed
which detects the vehicle number plate number using MATLAB.
3.2 Methodology
License plate detection is a common task in image processing and computer vision. It
involves identifying and localizing license plates in images or video frames. Here is a
general methodology for license plate detection using image processing:
1) Image Acquisition: The first step is to capture an image of the vehicle and its license
plate. This can be done using a camera installed at a fixed location or a mobile device
such as a smartphone.
2) Image Preprocessing: Start by preprocessing the input image to enhance the quality
and make subsequent processing more effective. Common preprocessing steps include
resizing, noise removal, and contrast enhancement.
Gaussian blur: The first step is to apply a Gaussian blur to the image. This is done
to smooth the image and reduce noise.
Gradient calculation: The next step is to calculate the gradient of the image. This
is done by calculating the derivatives of the image in the x and y directions.
3) Contour Extraction: Extract contours from the edge-detected image. Contours are
continuous curves that represent the boundaries of objects in an image. Most image
processing libraries provide functions or methods to find contours, such as OpenCV's
findContours() function. The contour detection algorithm traces the continuous curves
that represent the boundaries of connected components in the binary image.
6) Region of Interest (ROI) Extraction: Once potential license plate regions are
identified, extract the corresponding regions of interest (ROIs) from the original
image.
Detecting sparse text can be useful when there is lots of text in an image you need to
extract.When using PSM 11, Tesseract performs the following steps:
The image is analyzed for script and orientation information to assist in accurate
recognition.
The text regions are identified and segmented based on the script and orientation
analysis.
8) Output: Finally, display or output the detected license plate regions, along with any
recognized characters if character recognition was performed.
3.3 Algorithm
The sequence of processes associated with Number plate recognition is
given below. The file upload process is initiated by the recognition of License
Plate Number.
Input: Uploading the image file from camera
Output: Vehicle number plate in characters
1) Read the original image or Capture the image
2) Resize the image
3) Convert it to grayscale.
4) Apply Bilateral Filter.A bilateral filter is a non-linear, edge preserving, and noise-
reducing smoothing filter for images. It replaces the intensity of each pixel with a
weighted average of intensity values from nearby pixels.
5) Identify and store the Canny edges. The Canny edge detector is an edge detection
operator that uses a multi-stage algorithm to detect a wide range of edges in images.
6) Find the contours in from the edges detected and sort the top 10 contours.
7) Get the perimeter of each contour and select those with 4 corners.
8) Mask all other parts of the image and show the final image.
9) Read the text using Tesseract OCR.
On upload of the image file to the system, the number plate recognition system performs
its functions to provide the output.
4.1 CODE
import cv2
import imutils
import numpy as np
import pytesseract
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'
img = cv2.imread(‘car.jpg',cv2.IMREAD_COLOR)
img = cv2.resize(img, (600,400) )
cv2.imshow('orignal Image',img)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
cv2.imshow('Grayscale Image',gray)
gray = cv2.bilateralFilter(gray, 13, 15, 15)
cv2.imshow('Filtered Image',gray)
edged = cv2.Canny(gray, 30, 200)
cv2.imshow('Edged',edged) #drawing edges
contours = cv2.findContours(edged.copy(), cv2.RETR_TREE,
cv2.CHAIN_APPROX_SIMPLE)
contours = imutils.grab_contours(contours)
contours = sorted(contours, key = cv2.contourArea, reverse = True)[:10]
screenCnt = None
for c in contours:
peri = cv2.arcLength(c, True)
approx = cv2.approxPolyDP(c, 0.018 * peri, True)
if len(approx) == 4:
screenCnt = approx
break
if screenCnt is None:
detected = 0
print ("No contour detected")
Dept.,of AI&ML(2020 Batch) 14 2022-23
License Plate Detection using Image Processing
else:
detected = 1
if detected == 1:
cv2.drawContours(img, [screenCnt], -1, (0, 0, 255), 3)
mask = np.zeros(gray.shape,np.uint8)
new_image = cv2.drawContours(mask,[screenCnt],0,255,-1,)
new_image = cv2.bitwise_and(img,img,mask=mask)
cv2.waitKey(0)
cv2.destroyAllWindows()
4.2 Testing
License plate recognition (LPR) systems can face several challenges that can impact
their accuracy and performance. Here are some common problems faced in license plate
recognition:
Parameter Sensitivity: Canny edge detection requires tuning several parameters,
such as the threshold values for edge detection and hysteresis, which can be
challenging. Selecting inappropriate parameter values can lead to inaccurate edge
detection or missing important edges.
Computational Complexity: The Canny edge detection algorithm involves several
computationally intensive steps, such as convolution with Gaussian filters and non-
Dept.,of AI&ML(2020 Batch) 15 2022-23
License Plate Detection using Image Processing
maximum suppression. These operations can be time-consuming, especially for large
images or real-time applications.
Sensitivity to Noise: Canny edge detection is sensitive to noise in the input image.
Noise can produce spurious edges or cause the algorithm to miss true edges. Pre-
processing steps, such as noise reduction or smoothing, are often required to improve
the accuracy of edge detection.
Single Edge Width: The Canny edge detection algorithm produces edges with a fixed
width, determined by the width of the Gaussian filter used in the process. This
limitation means that it may not accurately represent edges with varying widths in the
image.
Discretization: Contours are typically represented by a series of connected points or
line segments. This discretization process can lead to information loss, resulting in an
approximation of the true edge. The accuracy of the contour representation depends
on the number of points used, but using too many points can be computationally
expensive.
Object connectivity: Contour-based edge detection algorithms may struggle to
handle objects that are touching or overlapping each other. In such cases, the contours
of adjacent objects can merge, resulting in a single contour that represents both
objects. Resolving object connectivity accurately is a challenging task for contour-
based methods.
Fragmentation: Conversely, in certain situations, contours may break up into
multiple smaller segments due to intensity variations within an object or region. This
fragmentation can result in incomplete or fragmented edge representations, making it
difficult to accurately identify the boundaries of object.
Edge-Based Object Detection: If the goal is to detect objects or shapes in an image
solely based on their edges, without the need for contour information, contour
detection may not be necessary. Edge detection methods like Canny can be sufficient
for this purpose, followed by object recognition or analysis based on the detected
edges.
Texture Analysis: Contour detection primarily focuses on the boundaries of objects
or regions, while texture analysis involves extracting information about the spatial
arrangement of pixels within an object or region. If the goal is to analyze textures in
an image, methods such as texture filters, texture descriptors (e.g., Local Binary
Firstly Input the captured image in RGB format from the device.
2)Grayscale Image:
The RGB image is converted into grayscale image to reduce the complexities in the color
image for further morphological operations
The Grayscale image is futher processed for noise reduction using the bilateral filter for
sharpening the edges and smoothing of the image.
4)Edged Image:
Edges are detected using the canny edge detection which helps to draw the contours for
the image
The License Plate region is extracted by sorting the contours in the image and a contour is
drawn for the region of License Plate.
6)Extracted image:
The region of License Plate is cropped from the whole image and displayed it.
The characters are recognized and output is displayed as below:
NUMBER PLATE RECOGNITIONS
CONCLUSION
Through this project it is possible to recognise Vehicle registration numbers
through digital image processing. The system has been designed using a modular
approach which allows easy upgrading and/or substituting of various sub-modules thus
making it potentially suitable for a large range of vision applications. The performances
of the system makes it a valid choice among its competitors especially in those situations
when the cost of the application has to be maintained at reasonable levels. Furthermore,
the modular architecture makes it extremely flexible and versatile. The earlier
methodologies which have been implemented have not been as accurate and efficient as
the designed Recognition system , this is because of the implementation of digital Image
Processing which gives an accuracy of 90% under normal conditions This Project is
based on automatic vehicle license plate recognition, in which it is observed that the
existing techniques don't pay much attention towards improving the system's efficiency in
terms of its power consumption. As the objective in our proposed design is to reduce
power consumption of the system, with the successful implementation of the same it will
play a very important role in traffic management and security systems such as automobile
theft prevention, parking lot management etc. implementations of the software algorithm
have shown promising results. The system can be made more robust if high precision
cameras can be used to increase overall accuracy if this system is implemented in real
time applications. Also a sensor can be designed to allow the camera to capture the image
only when required to save power.
[1] Kukreja, Amit, Swati Bhandari, Sayali Bhatkar, Jyoti Chavda, and
Smita Lad. "Indian vehicle number plate detection using image
processing." Int Res J Eng Technol (IRJET) 4, no. 4 (2017).
[2] "Automatic Number Plate Recognition" ,Rai, Vanshika, and Deepali
Kamthania. In Proceedings of the International Conference on
Innovative Computing & Communication (ICICC). 2021
[3] "Automatic vehicle number plate recognition for vehicle parking
management system." Jadhav, Ganesh R., and Kailash J. Karande.
Computer Engineering and Intelligent Systems, ISSN (2014): 2222-
1719.
[4] "Vehicle number plate detection using image processing",Singh,
Abhay, Anand Kumar Gupta, Anmol Singh, Anuj Gupta, and
Sherish Johri. International Research Journal of Engineering and
Technology (IRJET) 5, no. 03 (2018).
[5] Ganta, Srikanth, and Praveen Svsrk. "A novel method for Indian
vehicle registration number plate detection and recognition using
image processing techniques." Procedia Computer Science 167
(2020): 2623-2633.
[6] Soumya, Kumary R., Angel Babu, and Laya Therattil. "License plate
detection and character recognition using contour analysis."
International Journal of Advanced Trends in Computer Science and
Engineering (2014).
[7] Saraswathi, S., Ravi Subban, T. Shanmugasundari, and S. Manogari.
"Research on License Plate Recognition Using Digital Image
Processing." In 2017 IEEE International Conference on
Computational Intelligence and Computing Research (ICCIC), pp. 1-
6. IEEE, 2017.