Detection of Number plate of vehicle using Image
Processing
by
Manas
Enrollment No. 510615016
Dual Degree 8th Semester
A Term Paper Report submitted in partial fulfillment
of the requirements for the award of
Dual Degree (B.Tech. - M.Tech.)
in
Electrical Engineering
(Power and Energy Systems)
under the guidance of
Prof. Amal Barman
Department of Electrical Engineering
Indian Institute of Engineering Science and Technology
Shibpur, Howrah 711103
January 2019 to April 2019
1
i
INDIAN INSTITUTE OF ENGINEERING SCIENCE AND TECHNOLOGY,
SHIBPUR,
HOWRAH - 711103.
FORWARD
I hereby forward the term paper entitled Detection of Number plate of vehicle using image
processing prepared by Manas (Enrollment No.: 510615016) under the guidance and
supervision of Prof. Amal Barman in partial fulfillment of the requirements for the award of Dual
Degree (B.Tech. - M.Tech.) in Electrical Engineering (Specialization: Power and Energy
Systems).
................................................................
Prof. Amal Barman (Supervisor)
Associate Professor,
Department of Electrical Engineering,
IIEST, Shibpur,Howrah - 711103.
Countersigned by
.......................................... ..........................................
Dr. A. Sutradhar Dr. Sushanta Chakraborty
Professor and Head, Dean, Academic Affairs
Department of Electrical Engineering, IIEST, Shibpur,
IIEST, Shibpur,Howrah - 711103. Howrah - 711103.
1
ii
INDIAN INSTITUTE OF ENGINEERING SCIENCE AND TECHNOLOGY,
SHIBPUR,
HOWRAH - 711103.
CERTIFICATE OF APPROVAL
We hereby have approved the term paper entitled Detection of Number plate of vehicle using image
processing prepared by Manas(Enrollment No.: 510615016) under the guidance and supervision
of Prof. Amal Barman in partial fulfillment of the requirements for the award of Dual Degree
(B.Tech. - M.Tech.) in Electrical Engineering (Specialization: Power and Energy Systems).
Date........................................
(BOARD OF EXAMINERS)
1...........................................
2...........................................
3...........................................
4...........................................
2
Acknowledgements
I would like to acknowledge the resourceful guidance, active supervision and constant encouragement
of my guide Prof. Amal Barman of Department of Electrical Engineering, Indian Institute of
Engineering Science and Technology, Shibpur; who despite his other commitments, could make
time to help me and provide me with extraordinary laboratory facilities and insight. His constant
encouragement in the face of adversity is what kept me motivated. I do convey my sincere thanks and
gratitude to him.
I would also like take this opportunity to thank Dr. Ashoke Sutradhar, Head of The Department,
Electrical Engineering, Indian Institute of Engineering Science and Technology, Shibpur; for providing
the amenities and facilities that have helped me for the successful completion of the current study.
I would like to thanks Gaurav Kumar of Department of Electrical Engineering, Indian Institute
of Engineering Science and Technology, Shibpur; for his constant support and technical know-how
which have helped me complete the following report.
Last but not least, I thank my parents and my friends for being there for me when the going was
tough.
Dated (Manas )
iii
3
Contents
1. Introduction to Image Processing…………………………..5
1.1 How Digital Image is formed……………………………………..5
1.2 Mathematical Interpretation of a Digital Image…………..…….6
1.3 Applications of Image Processing …………………… …7
2. Motivation of the Project……………………………………..8
3. WORKING PRINCIPLE…………………………………….9
3.1 Input raw image…………………………………………………….10
3.2 Image binarization…………………………………………………………10
3.3 Reduce noise using mid-filtering method……………………………….10
3.4 Enhance contrast using histogram equalizer…………………………..10
3.5 Plate localization…………………………………………………………..11
3.6 Character segmentation……………………………………………16
4. EXPERIMENTAL RESULTS……………………………….16
5. Introduction To Opencv……………………………………17
5.1 Histogram Equalization……………………………………………17
6. Conclusion …………………………………………………..18
7. Future…………………………………………………………18
8. Reference……………………………………………………. 18
4
1. Introduction to Image Processing
Image processing is a method to perform some operations on an image, in order to get an
enhanced image or to extract some useful information from it. It is a type of signal processing in
which input is an image and output may be image or characteristics/features associated with
that image. Nowadays, image processing is among rapidly growing technologies. It forms core
research area within engineering and computer science disciplines too.
Image processing basically includes the following three steps:
• Importing the image via image acquisition tools;
• Analyzing and manipulating the image;
• Output in which result can be altered image or report that is based on image analysis.
There are two types of methods used for image processing namely, analogue and digital image
processing. Analogue image processing can be used for the hard copies like printouts and
photographs. Image analysts use various fundamentals of interpretation while using these visual
techniques. Digital image processing techniques help in manipulation of the digital images by
using computers. The three general phases that all types of data have to undergo while using
digital technique are pre-processing, enhancement, and display, information extraction.
How is a digital image formed
Since capturing an image from a camera is a physical process. The sunlight is used as a source
of energy. A sensor array is used for the acquisition of the image. So when the sunlight falls
upon the object, then the amount of light reflected by that object is sensed by the sensors, and a
continuous voltage signal is generated by the amount of sensed data. In order to create a digital
image, we need to convert this data into a digital form. This involves sampling and quantization.
5
(They are discussed later on). The result of sampling and quantization results in an two
dimensional array or matrix of numbers which are nothing but a digital image.
Mathematical Interpretation of a Digital Image
An image is treated as a matrix of MxN elements. Each element of the digitized image (pixel)
has a value that corresponds to the brightness of the point in the captured scene. An image
whose resolution in intensity is of 8 bits, can take values from 0 to 255. In the case of a black
and white image images it can take 0 and 1 values. In general, an image is represented in a
bidimensional matrix as shown in (2).
(2)
Since most of the devices acquire the images with a depth of 8 bits, the typical range of levels
of gray for an image is from 0 to 255 so that the matrix elements of the image is represented by
A=0...255
At this point it is convenient to say that even if the images are
acquired at RGB format, it is frequently transformed in a gray scale matrix and for achieving
the transformation from RGB type to gray Grassman level (Wyszecki & Stiles, 1982) is
employed:
Igrey=IR(0.299)+IG(0.587)+IB(0.114)
6
Application of Image Processing
The field of digital image processing has experienced continuous and significant expansion in
recent years. The usefulness of this technology is apparent in many different disciplines
covering medicine through remote sensing. The advances and wide availability of image
processing hardware has further enhanced the usefulness of image processing.
• medical applications
• restorations and enhancements
• digital cinema
• image transmission and coding
• color processing
• remote sensing
• robot vision
• facsimile
• pattern recognition
• multidimensional image processing
• image processing architectures and workstations
• video processing
Biomedical imaging concentrates on the capture of images for both diagnostic and therapeutic
purposes. Biomedical imaging technologies utilize either x-rays (CT scans), sound (ultrasound),
magnetism (MRI), radioactive pharmaceuticals (nuclear medicine: SPECT, PET) or light
(endoscopy, OCT) to assess the current condition of an organ or tissue and can monitor a
patient over time over time for diagnostic and treatment evaluation.
Image processing and computer vision techniques is used in Closed Circuit Television (CCTV)
cameras for security and surveillance monitoring, Commercial Video Motion Detection (VMD)
and Intelligent Scene Monitoring (ISM).
Major concerns in agriculture are water stress, quality of yields, and the use of pesticides.
Providing data and monitoring irrigation, whether artificial or natural, is possible by tracking
satellite imaging of fields over time.Foreign plants (weeds) growing in farms can also be
detected by combining image processing and machine learning techniques.
In the manufacturing, machine vision is used for detection, counting, and measuring in order to
help automate the process.
In military and security, image processing and computer vision is used for detecting a target,
tracking, recognize objects, etc
In photography and movie industry, image processing is used to enhance pictures, clean, cut,
combine, etc.
7
2. Motivation of the Project
Vehicle Number Plate Identification (VNPI) is a part of digital image processing which is
generally used in vehicle transportation system to categorize the vehicle. Number plate
recognition systems are having varieties of application such as traffic maintenances, tracing
stolen cars, automatic electronic Toll collection system etc. But the main aim is to control the
traffic management system. In India the traffic management system is developing day by day. In
India, the number plate containing white background with black foreground color is used for
private cars and for the commercial vehicles yellow is used as background and black as
foreground color. The number plate starts with two digit letter “state code” followed by two digit
numeral, followed by single letter after those four following digits as the below figure.
Fig. sample of number plate
In the above figure, 1 indicates the Country code, 2 indicates the state code, and 3 indicates
the district code, 4 indicates the type of vehicle and 5 indicates the actual registration number.
Locating the number plate is very stimulating work in the field of image processing. The whole
system mainly consists of two stages. First to identify the position of the number plate from the
particular vehicle and second segmentation of all the numbers and letters of the number plate.
The identification task is interesting because of the nature of the light. The position error will
increase if the color of the number plate is related to the background. Noise on the number plate
can sometimes cause error and low accuracy. There are some limitations that lead to failure in
most practical applications due to the diversity of the number plate characteristics and the
intricacy of the natural environment like rain, snow, for etc. we anticipated a method mainly
based on edge detection and morphological operation and decrease the noise using mid-
filtering noise removal method.
8
3. WORKING PRINCIPLE
Number plate is a pattern with very high disparities of contrast. If the number plate is very
similar to background it’s challenging to identify the location. Illumination and contrast is
changes as light fall changes to it.the morphological operations are used to eliminate the
contrast feature within the plate.
The work is distributed into several parts:
1. Input raw image
2. Image binarization
3.Reduce noise using mid-filtering method
4.Enhance contrast using histogram equalizer
5. Plate localization
6. Character segmentation
9
3.1. Input raw image
Input the image that is taken from the car
Fig. 3.1 Input car image
3.2. Gray scale conversion
From the input RGB image it has to be convert to gray scale and the 8-bit gray value is
intended.
3.3.Noise reduction
We used median filtering method to reduce the paper and salt noise. We have used 3x 3 masks
to get eight neighbors of a pixel and their consistent gray value.
3.4. Contrast enhancement using histogram equalization.
Using histogram equalization method the difference of each image is being enhanced. OpenCV has a
function to do this, cv2.equalizeHist(). Its input is just grayscale image and output is our histogram
equalized image. It enhances the contrast of the images by converting the values in an intensity image.
When image pixel intensity of 8-neibourgh connectivity, we supply a preferred histogram.
In below we state the change of histogram from original image and after smearing the contrast
enhancement using histogram equalization.
10
3.5. Plate localization
The basic step in recognition of vehicle number plate is to detect the plate size. In general
number plates are rectangular in shape. Hence we have to identify the edges of the rectangular
plate. Mathematical morphology will be used to detect that region.Sobel edge detector we used
to high light regions with a high edge magnitude and high edge alteration are identified.
Depending upon the threshold value edge will be detected from the input image. Figure 2.3
shows the input image before applying Sobel edge detection algorithm and figure 2.4 shows
after applying the Sobel edge detection method.
Figure: 3.2- Grayscale image after image enhancing.
11
Figure: 3.3 -After applying Sobel edge detection method
After edge detection eliminates all connected components that have lower than (eight pixel in
our method) pixels. Thus it will produce another binary image.
Figure:3.4 -After removing lower pixels.
12
In OpenCV there is a cvFloodFill() function that fills holes in the binarized image. The set of
background pixels are known as hole that cannot be reached by filling the background from the
edge of the image. Figure 3.5 shows after remove lower pixels connected components fills the
holes.
Figure: 3.5 -After filling the holes
Using flood fill algorithm we fill the hole to trace the plate region. Now neglecting the lower pixel
components to gets the actual plate.
Figure:3.6 -image after removing components with connectivity less than 1000 pixel
13
Using opencv cvBlobsLib function CBlobResult that stipulates the expected connectivity. All
components connectivity lower than 1000 pixel are removed to get the actual location of the
number plate. We output the four vertexes coordinates of the last selected region after
morphological filtering and extract the number plate .
Figure: 3.7- License plate before crop
The final positioning of the number plate after cropping.
Figure: 3.8 - The final number plate after the croping.
14
3.6. Character Segmentation
It measures a set of properties for each labeled region in the label matrix. We use boundingbox
to measure the properties of the image region. After labeling the connecting components, the
region will be removing from the input image.
Figure 3.9 - Segmentation of characters
4. EXPERIMENTAL RESULTS
We have run our proposed method on laptop. Several vehicle images are taken from our
campus of IIEST, Shibpur using dualcamera of 12+5 mega pixel by Redmi Note 5 pro mobile.
In the experiments, we test our proposed method on the different type car image to identify the
location exactly.
Fig 4.1 . Image of a car with proper lighting from behind.
15
Fig 4.2-Successful number plate.
5. Introduction To Opencv
OpenCV was started at Intel in 1999 by Gary Bradsky and the first release came out in
2000. Vadim Pisarevsky joined Gary Bradsky to manage Intel’s Russian software
OpenCV team. In 2005, OpenCV was used on Stanley, the vehicle who won 2005
DARPA Grand Challenge. Later its active development continued under the support of
Willow Garage, with Gary Bradsky and Vadim Pisarevsky leading the project. Right now,
OpenCV supports a lot of algorithms related to Computer Vision and Machine Learning
and it is expanding day-by-day.
One of the Function of Opencv
Histogram Equalization
Consider an image whose pixel values are confined to some specific range of values
only. For eg, brighter image will have all pixels confined to high values. But a good image
will have pixels from all regions of the image. So you need to stretch this histogram to
either ends (as given in below image) and that is what Histogram Equalization does (in
simple words). This normally improves the contrast of the image.
It has a function to do this, cv2.equalizeHist(). Its input is just grayscale image and output is our
histogram equalized image.
16
6.CONCLUSION
An efficient less time consuming vehicle number plate detection method is projected which
performed on multifaceted image. By using, Sobel edge detection method here detects edges
and fills the holes less than 8 pixels only. To removing the license plate we remove connected
components less than 1000 pixels. Our anticipated algorithm is mainly based on Indian
automobile number plate system. Extraction of number plate accuracy may be increased for low
ambient light image.
7.FUTURE
We all are in midst of revolution ignited by fast development in computer technology and
imaging. Against common belief, computers are not able to match humans in calculation related
to image processing and analysis. But with increasing sophistication and power of the modern
computing, computation will go beyond conventional, Von Neumann sequential architecture and
would contemplate the optical execution too. Parallel and distributed computing paradigms are
anticipated to improve responses for the image processing results.
8. REFERENCES
[1 ]. https://opencv-python-tutroals.readthedocs.io/en/latest/index.html
[2]. Deniing Jiang, Tulu Muluneh Mekonnen, Tiruneth Embiale, Ashenafi Gebrehiwot “Car Plate
Recognition System” in Fifth internation conference on Intelligent Networks and Intelligent Systems,
IEEE, 978-0-7695-4855-5/12 2012.
[3]. Huili Han, Runping Han “Method of License plate Location Based on Edge Detection and Color
Information”, IEEE, 978-1-4577-1701- 7/11, 2011, pp1477-1480.
[4]. https://onlinecourses.nptel.ac.in/noc18_ee40 DigitalImageProcessing
/preview
17