Automatic Number Plate Recognition By Using Matlab_Vignes Kumaran_E3_2018
Automatic Number Plate Recognition By Using Matlab_Vignes Kumaran_E3_2018
BY USING MATLAB
VIGNES KUMARAN
By
VIGNES KUMARAN
June 2018
Acknowledgment
Firstly, I would like to express my utmost gratitude to Dr. Mohd Ilyas bin Mohd
Sazali, my final year project supervisor, for his invaluable guidance and advice in
completing this project and seeing through this thesis. His guidance and patience
throughout the entire duration of this project is greatly appreciated. On top of that, his
incredible insights and support has culminated in the completion of this project.
Moreover, I would also like to thank to School of Electrical & Electronic Engineering for
providing funding which allowed me to carry out the work presented in this thesis. To my
friends and colleagues, special thanks for all the late night conversations when I was under
motivated to run the project. Finally, I would also extend my deepest gratitude to my
beloved family, who have consistently supported all my endeavors, including this project.
Throughout this project they have always been on my side, and supported me in every
i
Table of Content
Acknowledgements……………………………...…………………………..…………..i
Table of Content………………………………...…………………………..………….ii
List of Tables…………………………………………………...…………….………...vi
List of Figures……………………………………………...…...…………………..…vii
List of Abbreviation……………………………………………..……………………..ix
Abstract………………………………………………………….……………………...x
Abstrak………...………………………………………………..….…...………….......xi
Chapter 1 – Introduction
1.1 Background…………………………………………………………….……………1
1.3 Objectives………………………………………………………………….………. 4
2.1 Introduction…………………………………………………………………………7
2.1.1 MATLAB…………………………………………………………………7
ii
2.2.3 Edge Detection……………………………………………………………9
2.2.4 Morphology……………………………………………………………….9
2.5 Summary…………………………………………………………………..………..13
Chapter 3 – Methodology
3.1 Introduction……………………………………………………………….………...14
3.3.2 Preprocessing………………………………………………………….….22
iii
3.3.3.1 Edge Detection……………………………………..…………...24
3.5 Summary…………………………………………………………………...……….31
4.1 Introduction………………………………………………….……………………...32
4.4 Preprocessing………………………...…….……………………………………….34
Chapter 5 – Conclusion
5.1 Conclusion...…………………………….……………………………….…………46
References……………………...……………………..………………………………..48
Appendices
v
List of Table
vi
List of Figures
vii
Figure 3.18 Templates Used for Template Matching 30
viii
List of Abbreviations
HT Hough Transform
ix
AUTOMATIC NUMBER PLATE RECOGNITION BY USING MATLAB
ABSTRACT
Usually, surveillance system is used for security purposes and monitoring systems. This
surveillance system is also used for home security, traffic monitoring and at ATM
security. Human activity detection and tracking has increased in usage due to decreasing
cost of video surveillance camera. Moreover, automated systems had been designed for
numerous detection tasks, but the task of detecting illegally parked vehicles has been left
(ANPR) system is an image processing technology that identifies the vehicle by tracking
its number plate without direct human involvement and it is widely used in Intelligent
Transportation System (ITS). In this project, extraction and recognition of vehicle number
plate from an image is done by using MATLAB. The image of the vehicle is captured by
using camera and the image is sent to MATLAB by using Raspberry Pi 3. Besides, this
project presents an approach based on morphological operation and Sobel edge detection
method. Then, the approach is simplified to segmentation of all the characters in the
number plate by using bounding box method. The segmented character on the plate has
Furthermore, new algorithm in MATLAB has been used to extract the vehicle number
plate in various luminance condition. The system able to detect vehicle number plate at
x
PENGESAN NOMBOR KENDARAAN SECARA AUTOMATIK DENGAN
MENGGUNAKAN MATLAB
ABSTRAK
lalu lintas dan keselamatan ATM. Pengesanan dan pengesanan aktiviti manusia
meningkat secara praktikal kerana penurunan dalam kos kamera pengawasan video.
Selain itu, sistem automatik telah direka untuk pelbagai tugas pengesanan, tetapi tugas
mengesan kenderaan yang diletak secara haram telah diserahkan untuk pengendali sistem
Secara Automatik (ANPR) adalah teknologi pemprosesan imej yang mengenal pasti
secara langsung dan ia digunakan secara meluas dalam Sistem Pengangkutan Pintar
(ITS). Dalam projek ini, pengekstrakan dan pengesanan nombor kenderaan daripada
dengan membahagikan semua aksara dalam plat nombor dengan menggunakan kaedah
kotak terikat. Watak bersegmen pada plat telah diekstrak dan dikesan dengan
menggunakan imej template watak abjad dan angka. Selain itu, algoritma baru dalam
pelbagai keadaan pencahayaan. Sistem ini dapat mengesan plat nombor kenderaan pada
xi
CHAPTER 1
Introduction
1.1 Background
A number plates is attached to vehicle for identity purposes and it is a legal necessity
that applies to vehicles in most countries. It gives a unique identity to a vehicle, which
can be used to trace the vehicle owner through a database which is linked to the record of
information, such as owner details and vehicle details. All license plates must be
registered with the owner’s name, address, and registered number under the world’s first
Currently, a license plate can be used to avoid traffic violations such as car theft,
running the red light and over speed. However, due to the increasing number of vehicle
from year to year, it is not possible to manually keep record of entire vehicle and traffic
violations are appearing more frequently. Although, many of surveillance cameras are
installed at places such as parking booths, toll booths, gated and guarded community areas
and traffic lights, they require man-power to check their images and note down the vehicle
registration number so that it can be sent to appropriate department to take rule violators
action. To overcome this problem, the Automatic Number Plate Recognition (ANPR) was
invented. This ANPR is also known as License Plate Recognition (LPR), Car Plate
Recognition (CPR), Mobile License Plate Reader (MLPR), Automatic License Plate
Automatic Number Plate Recognition (ANPR) is a system which aids human to detect
car number plate. Besides, ANPR is an image processing technology that able to
automatically identify the vehicle by extracting car number plate characters from an
1
image without direct human involvement. This system is able to extract and recognize the
car number plate characters from stationary camera monitoring system and mobile
is beneficial for many businesses and organizations for a wide variety of applications
including vehicle parking lot management, highway ticketing, electronic toll collection
and security applications such as access control to restricted areas and tracking of wanted
vehicles [3].
Besides, ANPR can be used as a form of security at campus and gated communities
through automatic opening of the gate only to authorized vehicles. ANPR will recognize
the car number plate automatically and compare the number with the numbers in the
database. If that specific plate number is in the database, then the gate lifts up and the car
will be allowed to enter the property. This can help save man power as the security guards
Moreover, ANPR can also be used as parking management system at parking garages
and parking lots [4] as shown in Figure 2.1. It can improve traffic flow during peak
periods and manage information about car park usage. ANPR also can help user to
relocate their vehicle in a large parking lot by detecting the location of the vehicle after
the implementation of new hardware and software. However, the current accuracy is not
able to satisfy all the requirements in various fields. Successful implementations of ANPR
system will make the vehicle identification process becomes faster and easier.
Many years ago, private car was a deluxe device and it will only be used by a few
people. Time consciousness in the modern day has made the car a basic need in human
life. Therefore, the number of car owners is increasing every day because every person
expects the freedom to travel and comfort while travelling. They travel from one place to
another for a great variety of reasons. Most family in developed countries own at least a
car and this situation is not much different in developing countries either. However,
owning a car has some disadvantages as well. The main disadvantage of owning a car is
In Malaysia, most of the parking management at parking lots are using conventional
car park ticketing system which requires human effort to keep the parking ticket safely
and pay at autopay station. However, the problem will arise in this conventional car park
system when the user had misplaced or accidently lost the parking ticket. The user will
be charged a higher rate as they could not verify the duration they used the car park.
Besides, the low quality of the parking ticket will cause difficulties to autopay machine
system to calculate the amount of fee for the parking service. This conventional car park
ticketing system also might cause damage to the car as the user has to drive their car close
to the parking ticket kiosk for them to reach out their hand to the kiosk and take the
parking ticket.
3
Furthermore, the gated community usually use membership sticker which will be
attached on the windscreen of the vehicle to enable the car driver to get access to the
place. Thus, the security guard must be hired for them to check each vehicle one by one
and confirm the membership details by checking the membership sticker on the
windscreen of the vehicle or by checking the driver’s identification card before giving
permission to enter the gated area. The security guard must record the vehicle details such
as vehicle number plate onto an occurrence book which might cause in loss of data
and gated community security control, conventional car park ticketing system and human
control security can be replaced. However, current ANPR system has its own
disadvantages as the vehicle image must be captured from a fixed distance [5]. The
current ANPR system also faces major problem when detecting vehicle license plate with
1.3 Objectives
2. To develop a system that able to recognise vehicle license plate with different
distance of vehicle licence plate from camera and identify the unregistered
vehicle.
3. To create a device hardware capable of capturing pictures and sending the data
4
1.4 Project Scope
For this project, the proposed system serves as an improvement and alternative to the
car identification and current car park management system. The scope of the project is to
develop an algorithm to identify the characters from vehicle license plates by using
integrate all the software and Raspberry Pi Noir camera board v2 to capture the real time
image into personal computer for license plate recognition process. In practice, the system
must be able to reduce human effort in managing the increasing number of car.
This thesis is split into five chapters, each of which containing important descriptions
of this project. Various progressions and parts of this project are described in these
chapters, and in reading this thesis, a more in-depth understanding of image processing
for car plate number recognition will be acquired. This thesis is structured as follows:
Chapter 1: An introduction to the build of this project, which includes the Background,
the recent researches and scholarly sources relevant on the particular issues
5
Chapter 3: This chapter is dedicated to the Methodology of this build, where the process
the system, both hardware and software in its entirety is illustrated and
Chapter 4: Here the various experiments and tests that are conducted throughout the
Chapter 5: The conclusion and the highlight in the development of the system is put forth
6
CHAPTER 2
Literature Review
2.1 Introduction
In general, ANPR systems are divided into four steps, namely input image capture,
number plate detection, character segmentation and character recognition. The accuracy
of number plate recognition mainly depends on the quality of input image capture. The
input image which has low quality and does not have component of vehicle number plate
might cause the system to detect the number plate wrongly and this will be one of the
major issues that will lead to an inaccurate result. This chapter will focus more on the
literature survey on vehicle number plate detection. This chapter starts off with the
introduction about the MATLAB software in section 2.1. Section 2.2 investigates the
image segmentation techniques to detect vehicle number plate, while Section 2.3 goes
into the character segmentation method. The character recognition methods which is used
to detect vehicle plate number are explained in Section 2.4. The final portion of this
2.1.1 MATLAB
MATLAB is a data analysis and visualization tool which has been designed with
powerful support for matrices and matrix operations that has excellent graphics
capabilities and powerful programming language. MATLAB programs which are known
as toolboxes are designed to support a task such as investigating images and their
properties which will be supported by image processing toolbox and image acquisition
toolbox. A MATLAB function such as sin, imread, and imclose is a keyword which
accepts various parameters and produces output in the form of a graph, a string, a matrix
or a figure. MATLAB’s standard data type is the matrix and all the data are matrices. For
example, images are matrices whose elements are the grey values or RGB values of
7
pixels. Single values are considered by MATLAB to be 1 x 1 matrix, while a string is
Number plate detection is a process to locate the vehicle number plate which will help
the ANPR system for faster character identification over a smaller region. To detect the
vehicle number plate, factors such as number plate size and number plate location must
be considered as the vehicle number plate can be of different sizes in different input
images and the number plate can be located anywhere in the vehicle. The vehicle number
plate can be detected by using image segmentation method and there are various image
segmentation methods that can be applied. In the following sections, common vehicle
number plate detection methods are explained, and it is followed by detailed discussion
by calculating the threshold value of the image. A correct threshold value is important to
produce black and white image from a grayscale image. In this method, threshold must
be set to classify black pixels and white pixels. The threshold can either be set fixed or
adaptive using a clustering algorithm which is called Iso Data Algorithm [5]. This
8
algorithm will first count the appearance of each tone in the image and tries to find a good
center.
of objects in an image. It is a basic method for image segmentation and data extraction.
Differential, and Roberts Cross can be used for edge detection [7].
2.2.4 Morphology
Morphology is a set of image processing operations that are useful in the shape
binary image processing that is used to detect boundaries of object. The most basic
morphological operations are dilation and erosion. Dilation will cause object to grow as
it adds pixels to the boundaries of object in an image while erosion will cause the size of
Image binarization, edge detection and morphology are basic methods for plate
identification. Aside from these techniques, various researches discussed about various
techniques for plate detection. Anagnostopoulos et al. [7] proposed sliding concentric
window (SCW) technique that consists of two steps method containing two concentric
windows moving from upper left corner of image which calculate the statistical
measurement in both windows based on segmentation rule that says the central pixel of
the windows is considered belong to region of interest (ROI) if the ratio of the median or
9
mean in the two windows exceeds a threshold that had been set based on try and error
basis. Chen et al. [8] proposed a feature silent method to extract vehicle number plate by
using features such as texture, shape, and colour. Hough transform (HT) was used to
detect horizontal and vertical line from vehicle number plate. Then, red, green, blue
Lakshmi et al. [9] proposed a novel approach for Indian License Recognition System
which is based on wavelets and texture characteristics. Morphology operation was also
Character segmentation is the step that acts as a bridge between the number plate
detection and character recognition. In this phase, the area that contains characters are
quadtree partition and the data structure used is called quadtree. It divides regions that do
not pass the homogeneity test and combine regions that pass the homogeneity test [5].
the ordinary characteristic of the image [8]. In this technique, the regions are grouped to
ensure the pixels in the region have the similar value of the properties such as pattern and
texture, spectral profile of the image, and the intensity values. Pan et al. [10] proposed an
10
improved projection method by mentioning three-step procedures for character
segmentation which start with correction of vertical, horizontal and compound tilts. Then,
to detect connected boundaries, lines are drawn in between first and last characters before
the characters are segmented after removing noise. Ozturk and Ozen [11] used vertical
column sum vectors. Two adjacent characters are separated in two based on the algorithm.
Character recognition is the last stage in ANPR that identifies and converts segmented
character from an image into editable text. Character recognition has been a complication
in the field of image processing, as there is high probability that the character produced
from the normalization step varies from the database in terms of shape, size and style that
could result in inaccuracy in character recognition and affect the usefulness of the whole
system. Character recognition is the most important task in recognizing the number
plate and the system must be able to differentiate the character correctly as sometimes the
system may be complicated due to the similarities in the form of shape as the characters
consist of numbers and letters. In this section, each method that is used to identify
Template matching has been used widely in face detection, medical image
processing and ANPR. The recognition of the segmented character in ANPR is done by
calculating the correlation coefficient where the template character that scores the highest
correlation is selected as the character of the segmented character from an image. The
size of the segmented character image and the template character must be the same [12].
Recently, Puranic et al. [13] proposed the development of automatic vehicle plate
11
detection system by utilising template matching concept which calculates the correlation
coefficient and the template character that scored the highest correlation will be selected
(KNN) which the technique recognised the character based on least difference between
the segmented character and the template character. Soon et al. [14] used KNN to classify
the characters for recognition purpose. In this approach, every character class must train
the KNN classifier by using training samples which will be extracted as feature vectors
for the classifier. However, character similarities such as “5” and “6”, “1” and “7” might
cause inaccuracy in recognition. Bedruz et al.[15] used Fuzzy Image Processing for text
detection and character recognition. This system has a short processing time and high
accuracy but it is sensitive to distortion and noise. More recently, Maghsoudi et al. [16]
proposed Artificial Neural Network(ANN) technique in automatic car plate detection and
recognition system. ANN provides good accuracy in recognition, but it requires periodic
12
2.5 Summary
In summary, the current and basic knowledge on vehicle number plate detection and
its approaches were studied in this chapter. The general understanding on MATLAB
software were explored as well. The proposed project aims to develop an ANPR using
the knowledge obtained in this literature review. Moreover, the limitation of the current
ANPR system were identified which the vehicle image must be captured from a fixed
13
Chapter 3
Methodology
3.1 Introduction
detecting vehicle number plate automatically. Attached to this project are two major
components, that are hardware development and software development. The device is
made up of Raspberry Pi 3 Model B which captures image using Pi Noir Camera V2.
This image is then sent over via a Wi-Fi network to MATLAB software. The MATLAB
software will detect car number plate automatically by using image processing toolbox.
Figure 3.1 shows the build flowchart with a detailed breakdown of the development of
whereas Figure 3.2 illustrates a basic breakdown of the entire system architecture for
ANPR. The hardware development will be detailed in Section 3.2, while the system
14
Start
Hardware Development
Raspberry Pi 3 Model B
Pi NoIR Camera V2
Software Development
No
System Testing and
Troubleshooting
Yes
End
15
Pi NoIR Camera Raspberry Pi 3
V2 Data Model B
captured
View Data
Security guard
16
3.2 Hardware development
controller board and a computer. In this project, Pi NoIR Camera V2 is used in the image
acquisition stage. It is primarily used to capture the image of vehicles. Figure 3.3 shows
Besides that, Raspberry Pi 3 Model B is used as the controller board for this project as
shown in Figure 3.4. This controller board is used to send the captured image via Wi-Fi
network to the computer that had been installed with MATLAB software. Table 3.1 shows
17
Table 3.1: Hardware specification
Hardware Specification
1GB RAM
(BLE) on board
RAM: 8.00GB
18
3.3 Software Development
software is installed in Windows 10 operating system. Figure 3.5 shows the flowchart
diagram of the steps done by the MATLAB software to recognize vehicle plate number
automatically. The details of each step are to follow in the following sections. The
Start
Image Acquisition
Edge Detection
Mathematical Morphology
Character Segmentation
19
Character Segmentation
YES
YES NO
Templates Loading and Reading
Character Recognition
Bounding Box ?
NO
YES
End
20
3.3.1 Image Acquisition
Image Acquisition is the process of obtaining an image from the digital camera. Images
are taken at various distances in different backgrounds and illuminations. Different types
of images such as bright image, dark image and blurred image can be acquired during
camera capturing. Figure 3.6 shows the input image of a vehicle image. This vehicle
image can be captured by using image acquisition toolbox which can help MATLAB to
get image and video directly from the camera. Besides that, MATLAB can detect the
hardware and configure the hardware properties automatically. Figure 3.7 shows the
screenshot of the camera configuration that has been detected by MATLAB automatically
21
Figure 3.7: Camera Configuration
3.3.2 Preprocessing
The preprocessing is used to improve the input image and make it suitable for vehicle
number plate recognition. Preprocessing will enhance the image by removing the
background noise, removing image reflection, image debluring and normalizing the
intensity of individual image particles. The preprocessing for vehicle license plate number
After the image is acquired, the image is resized to 480 x NaN resolution. In this
resolution, the RGB image will resize to have 480 rows and the number of columns is
calculated automatically. The resizing is used to resize an image and make the input
images size become more constant which will allow the system to perform operation in a
more effective manner by decreasing its computational time. imresize function is used to
resize an image in MATLAB. Figure 3.8 shows the input and output image that is resized
22
Input Image Output image
The captured input image is converted from RGB image to gray scale image. This
conversion is done by using rgb2gray function in MATLAB. Figure 3.9 shows the gray
scale image. The RGB image is converted to gray scale by eliminating the saturation
information while retaining the luminance. This is done by converting RGB values to
23
3.3.3 License Plate Detection
License plate detection identifies specific features that contain the vehicle number plate
in an input image. The vehicle number plate can be found anywhere within an image and
it is impractical to check all the pixels of the image in order to locate the vehicle number
plate. Therefore, the license plate detection can help ANPR system to only focus on those
pixels that have number plate. License plate detection can be categorized into four
subsections which are edge detection, mathematical morphology, actual number plate
detection and extracted number plate region enhancement. A brief explanation of these
Edge detection using Sobel method is done on binary image in order to identify the
boundaries of character that are not broken as the edges. This edge detection is a set of
mathematical methods that identify points in digital image at which the brightness
changes sharply and has discontinuities. The point at which image brightness changes
sharply are typically organized into a set of curved line segments termed edges. Figure
3.10 shows the results of applying Sobel operator to binarized image. Edge detection is
used to distinguish the edge in picture to localize the position of vehicle number plate.
After experimenting with different types of edge detection method which consist of Sobel,
Prewitt and Canny; Sobel edge detection method was chosen as it provides the fastest
processing time.
24