Professional Documents
Culture Documents
by
Duppala Pujitha (CSE241-38110142)
Shaik Danisha (CSE241-38110517)
SATHYABAMA
(DEEMED TO BE UNIVERSITY)
Accredited with Grade “A” by NAAC
1
MARCH - 2022
BONAFIDE CERTIFICATE
This is to certify that this Project Report is the bonafide work of D.Pujitha (38110142),
S.Danisha(38110517)who carried out the project entitled“License Plate Recognition Using
Open-Cv Python” under my supervision from December 2021 to March 2022.
InternalGuide
Mr. A.YOVAN FELIX,M.E,
Dr.L.LAKSHMANAN, M.E.,Ph.D.,
2
Internal Examiner External Examiner
DECLARATION
ID.Pujitha (38110142), S.Danisha (38110517) hereby declare that the Project Report entitled
” License Plate Recognition Using Open-Cv Python” done by me under the guidance of
Mr.A.Yovan Felix., M.E., is submitted in partial fulfillment of the requirements for the award of
DATE:
3
ACKNOWLEDGEMENT
I would like to express my sincere and deep sense of gratitude to my Project Guide Mr.A.Yovan
Felix M.E.,for his valuable guidance, suggestions and constantencouragementpaved way for
the successful completion of my project work.
I wish to express my thanks to all Teaching and Non-teaching staff members of the
Departmentof Computer Science and Engineeringwho were helpful in many ways for
thecompletionof the project.
4
ABSTRACT
In recent years the number of vehicles has increased drastically. With this increase, it is becoming
difficult to keep track of each vehicle for purpose of law enforcement and traffic management.
License Plate Recognition is used increasingly nowadays for automatic toll collection, maintaining
traffic activities and law enforcement. Many techniques have been proposed for plate detection,
each having its own advantages and disadvantages. The basic step in License Plate Detection is
localization of number plate. Automatic License Plate Recognition system is a real time embedded
system which automatically recognizes the license plate of vehicles. There are many applications
ranging from complex security systems to common areas and from parking admission to urban
traffic control. Automatic license plate recognition (ALPR) has complex characteristics due to
diverse effects such as of light and speed. Most of the ALPR systems are built using proprietary
tools like Matlab. This system presents an alternative method of implementing ALPR systems
using Free Software including Python and the Open Computer Vision Library.
5
TABLE OF CONTENTS
6
CHAPTER NO. TITLE PAGE NO
4.5 Clearing Areas of a Binary 10
Image
4.6 Detecting Edges 11
4.7 Illustration 12
4.8 Filter Function 12
5
5.1 Python 14
5.2 History 14
5.3 Open-CV 18
5.3.1 History 18
5.3.2 Applications 19
5.4 Programming Language 19
5.4.1 OS Support 20
5.5 What is OCR? 20
6 RESULT AND DISCUSSION 32
7 CONCLUSION AND FUTURE WORK 36
APPENDIX
A. Source Code 48
7
LIST OF FIGURES
FIGURE NO FIGURE NAME PAGE NO
3.1 Block Diagram 5
5.1 EasyOCR Framework 21
5.2 PyTorch 22
5.3 Installing pip Torch 22
5.4 Installing EasyOCR 23
5.5 OCR 24
5.6 Common Text 26
5.7 Draw results for Single-line 28
Text-Example 1
5.8 Draw results for single-line text 29
5.9 Draw results for multiple lines 31
5.10 Reading multiple lines 31
6.1 Code File 32
6.2 Input Image 33
6.3 Gray scale conversion 33
6.4 Bilateral Filter Image 34
6.5 Candy Edges Detection 34
6.6 Detecting License Plate Number 35
6.7 License Plate Recognition 35
6.8 Results Stored in Excel Sheet 35
8
LIST OF ABBREVATIONS
ABBREVATION EXPANSION
OCR - Optical Character Recognition
CNN - Convolutional Neural Network
CV - Computer Vision
DL - Deep Learning
KNN - K-Nearest Neighbor
ALPR - Automated License Plate
Recognition
9
CHAPTER 1
INTRODUCTION
With increasing number of vehicles on roads, it is getting difficult to manually enforce
laws and traffic rules for smooth traffic flow. Toll-booths are constructed on freeways and
parking structures, where the car has to stop to pay the toll or parking fees. Also, Traffic
Management systems are installed on freeways to check for vehicles moving at speeds
not permitted by law. All these processes have a scope of improvement. In the centre of
all these systems lies a vehicle. In order to automate these processes and make them
more effective, a system is required to easily identify a vehicle. The important question
here is how to identify a particular vehicle? The obvious answer to this question is by
using the vehicle’s number plate. Vehicles in each country have a unique license
number, which is written on its license plate. This number distinguishes one vehicle from
the other, which is useful especially when both are of same make and model. An
automated system can be implemented to identify the license plate of a vehicle and
extract the characters from the region containing a license plate. The license plate
number can be used to retrieve more information about the vehicle and its owner, which
can be used for further processing. Such an automated system should be small in size,
portable and be able to process data at sufficient rate various license plate detection
algorithms have been developed in past few years. Each of these algorithms has their
own advantages and disadvantages. Arth ET al.described the method in which license
plate is detected using confidence related predictions. As multiple detections are
available for single license plate, post –processing methods are applied to merge all
detected regions. In addition, trackers are used to limit the search region to certain
areas in an image. Kwasnicka at el. suggests a different approach of detection using
binarization and elimination of unnecessary regions from an image. In this approach,
initial image processing and binarization of an image is carried out based on the
contrast between characters and background in license plate. After binarizing the
image, it is divided into different black and white regions. These regions are passed
through elimination stage to get the final region having most probability of containing a
number plate
1
CHAPTER 2
Literature Survey
2.1. Title 1:Number Plate Recognition by using open CV- Python
Author: Tellapavani, DVR Mohan | Mar 2019 ,License Plate Recognition was 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.
Advantages:
Machine Learning Algorithms such as KNN is very effective for vehicle number plate
recognition using machine learning
Disadvantages:
The existing system to determine the details of a vehicle requires a lot of human
interaction which also leads to human errors.
2.2. Title 2: Automatic Number Plate Recognition System based on Deep Learning
Author: TaheniDamaK,OussemeKriaa, AsmaBaccar, Mohamed Ali Ben Ayed April
2020,In the last few years, Automatic Number Plate Recognition (ANPR) systems have
become widely used in the safety, the security, and the commercial aspects.
Forethought, several methods and techniques are computing to achieve the better
levels in terms of accuracy and real time execution. This paper proposed a computer
vision algorithm of Number Plate Localization (NPL) and Characters Segmentation
(CS). In addition, it proposed an improved method in Optical Character Recognition
(OCR) based on Deep Learning (DL) techniques. In order to identify the number of
detected plate after NPL and CS steps, the Convolutional Neural Network (CNN)
algorithm is proposed.
Advantages:
The proposed technique measures accuracy about 96 % of the system.
Disadvantages:
2
This paper proposes a method of localization and recognition using MATLAB, A
summary of the ANPR systems related works where the accuracy results were between
85% and 97.19% is described. But, no results are mentioned for the proposed ANPR
system.
3
CHAPTER 3
3.1 Existing system:
In existing system presents a system called NPR (Number Plate Recognition) which is
based on image processing and is used to detect the number plates of vehicles and
process them to record the information. In a fast-growing world, it has become almost
impossible to track illegal vehicles and store vehicle information. This is eventually
leading to a rise in the crime rate, especially due to manual errors. The proposed
system first captures the vehicle image and the vehicle number plate region is extracted
using Image Segmentation in an image. The resulting data is then used to compare with
the records on a database to come up with specific information like the vehicle's owner,
place of registration, address, etc. Further, the system is implemented and simulated in
MATLAB for studying feasibility and accuracy on a real image.
3.2PURPOSE OF THIS PROJECT:
• The main purpose of this project is to detect a license plate from an image provided
by a camera. An efficient algorithm is developed to detect a license plate in various
luminance conditions. This algorithm extracts the license plate data from an image
and provides it as an input to the stage of Car License Plate Recognition
• Automatic Number Plate Recognition is a fairly well explored problem with many
successful solutions.
• However, these solutions are typically tuned towards a particular environment due to
the variations in the features of number plates across the world.
• Algorithms written for number plate recognition are based on these features and so
a universal solution would be difficult to realize as the image analysis techniques
that are used to build these algorithms cannot themselves boast hundred percent
accuracy.
4
• The focus of this paper is a proposed algorithm that is optimized to work with
Ghanaian vehicle number plates. The algorithm, written in C++ with the Open CV
library, uses edge detection and Feature Detection techniques combined with
mathematical morphology for locating the plate.
• The Tesseract OCR engine was then used to identify the detected characters on the
plate.
5
CHAPTER 4
METHODOLOGY
In this paper the text found on the vehicle plates is detected from the input image and
this requires the localization of number plate area in order to identify the characters
present on it. In literature we can find many methods for number plate detection and
recognition system. The major drawback is that how long it will take to compute and
recognize the particular license plates. This is critical and most needed when it is
applied to real time applications. However, there is always a trade-off between
computational time and performance rate. In order to achieve an accurate result and
increase the performance of the system more computational time is required. For
number plate detection or localization, techniques based on edge statistic and
mathematical morphology gives a very good result that uses vertical edge information to
calculate the edge density of the image followed by morphology methods such as
dilation to extract the region of interest. This technique works well due to the fact that
number plates always have high density of vertical edges. But in this method as
unwanted edges in the background are also detected which leads to confusion, it is
difficult to apply this method for number plates with complex background. Colour based
techniques are proposed in this thesis work. The draw back with this method is that it
performs well when the lighting condition is constant but when there is various
illumination condition its performance reduces. But in real-time application normally the
images can be obtained with various lighting illumination. Furthermore, the proposed
technique is country specific because each country will have different colour code for
vehicle number plate. Connected Component Analysis (CCA) method is used to detect
the number plate region. CCA is useful for simplifying the detection task .since it labels
binary image into several components based on their connectivity. Based on the
problem one can decide on the selection of finding the connected components using
4-adjacency or 8-adjacency of pixels connectivity. Spatial measurement is a measure of
spatial characteristics of a connected component such as area, orientation, aspect ratio
etc. and filtering is done to eliminate unrelated or unwanted components. When
6
Connected Component Analysis is combined with spatial measurement and filtering
produces better result in number plate detection. Automatic recognition of car license
plate number became a very important in our daily life because of the unlimited increase
of cars and transportation systems which make it impossible to be fully managed and
monitored by humans, examples are so many like traffic monitoring, tracking stolen
cars, managing parking toll, red-light violation enforcement, border and customs
checkpoints. Yet it’s a very challenging problem, due to the diversity of plate formats,
different scales, rotations and non-uniform illumination conditions during image
acquisition. This paper presents an approach using simple but efficient morphological
operations, filtering and finding connected components for localization of Indian number
plates. The algorithm has been tested on 20 samples and is found to extract both
alphabets and numbers from vehicle license plates images with an accuracy of 90% for
four wheeler license plates of different regions in different climatic conditions. HD
number plates are also identified by resizing them to aspect ratio.
4.1. PRE-PROCESSING:
4.1.1. Introduction
Image pre-processing is the term for operations on images at the lowest level of
abstraction. These operations do not increase image information content but they
decrease it if entropy is an information measure. The aim of pre-processing is an
improvement of the image data that suppresses undesired distortions or enhances
some image features relevant for further processing and analysis task. Image
pre-processing use the redundancy in images. Neighbouring pixels corresponding to
one real object have the same or similar brightness value. If a distorted pixel can be 98
picked out from the image, it can be restarted as an average value of neighbouring
pixels. Image pre-processing methods can be classified into categories according to the
size of the pixel neighbourhood that is used for the calculation of a new pixel brightness.
In this paper, it will be presented some pixel brightness transformations and local
pre-processing methods realized in python.
8
• 0 ≤ T(r) ≤ 1 for any r ∈ [0, 1].
The original and transformed grey levels can be characterized by their probability
density functions. Contrast is the local change in brightness and is defined as the ratio
between average brightness of an object and the background brightness. Histogram
equalization technique is based on modifying the appearance of an image by controlling
the probability density function of its gray levels by the transformation function T(r). This
technique enhances the contrast in the image.
9
requirements about the size and shape of the observed object, can be realized by the
same way.
4.6. DETECTING EDGES
Edges are pixels where the intensity image function changes abruptly. Edge detectors
are collection of local image pre-processing methods used to locate changes in the
brightness function. An image function depends on two variables, co-ordinates in the
image plane. Operators describing edges are expressed by partial derivatives. A
change of the image function can be described by a gradient that points in the direction
of the largest growth of the image function. An edge is a vector variable with two
components, magnitude and direction. The edge magnitude is the magnitude of the
gradient. The edge direction is rotated with respect to the gradient direction by −π/2.
The gradient direction gives the direction of maximum growth of the function, e.g., from
black to white. The boundary and its parts are perpendicular to the direction of the
gradient [2, 9]. The gradient magnitude |grad g(x, y)| = s³ ∂g ∂x ´2 + ³∂g ∂y ´2 and
gradient direction ϕ = arg³ ∂g ∂x, ∂g ∂y ´ are continuous image functions where arg(x, y)
is the angle from x axis to the point (x, y). A digital image is descrete in nature and
these equations must be approximated by differences of the image g, in the vertical
direction for fixed i and in the horizontal direction for fixed j, by following equations ∆i g(i,
j) = g(i, j) − g(i − n, j) ∆j g(i, j) = g(i, j) − g(i, j − n), where n is a small integer chosen so to
provide a good approximation to the derivative and to neglect unimportant changes in
the image function. 103 Gradient operators approximating derivatives of the image
function using differences use one or several convolution masks. Beside them, this tool
uses operators based on the zero-crossings of the image function second derivative.
Sobel, Prewitt, and Roberts methods find edges by thresholding the gradient and by
them horizontal edges, vertical edges or both can be detected. The Laplacian of
Gaussian method thresholds the slope of the zero crossings after filtering the image
with a LoG filter. Canny method thresholds the gradient using the derivative of a
Gaussian filter. One option in the main menu provides processing of the image region of
interest or the whole image. It has to move the pointer over the image on the left and
when the cursor changes to a crosshair, it has to click on points in the image to select
vertices of the region of interest. Offered operations to perform are UN sharping,
histogram equalization technique, low pass filtering, median filtering, and brightening,
darkening, increasing contrast, decreasing contrast and boundary interpolation.
4.7. ILLUSTRATION
The tool for image pre-processing is realized in Mat Lab. The following illustration
shows the results of many pre-processing actions. The input image is Doppler image of
blood vessel. First, it can be cropped and its irrelevant parts can be removed. Image
region of interest is focused
10
Filtering in image processing is a process that cleans up appearances and allows for
selective highlighting of specific information. A number of techniques are available and
the best options can depend on the image and how it will be used. Both analog and
digital image processing may require filtering to yield a usable and attractive end result.
This can be a routine part of the editing process used to prepare images for distribution.
Digital filtering offers a number ofadvanced photo manipulation options beyond the
basic filters used in photo development. One common use of filtering in image
processing is to remove blur. Images may be blurry because of file degradation, moving
objects in the frame when the photo was taken, and other issues. The photographer can
use a filtration algorithm to selectively target pixels and smooth the image out. More
complex filters may be able to reconstruct partially damaged images through averaging,
using available data to estimate missing contents in an image.
Another use for filtering in image processing is in the handling of images where
technicians want to highlight specific objects of interest in the picture. For example,
astronomers might pass an image through filters to selectively restrict data from certain
wavelengths. This can allow other information in the image to pop into relief. Filters can
also remove noise like haze from images to make them cleaner and clearer, even if they
are not specifically blurred.
Software programs allow for very complex filtering in image processing. Many come
with presents that people can use for basic tasks like adding soft filters to portraits or
sharpening up contrast in dim images. Users can also develop their own filters, coding
in specific parameters to make a custom version for a particular need or project. This
may require advanced programming skills, as well as a thorough knowledge of how
photography.
11
CHAPTER 5
SOFTWARE MODULES:
IMAGE PROCESSING TOOL: OPENCV
PROGRAM: PYTHON
12
functional programming, and procedural styles. It has a large and comprehensive
standard library. Python interpreters are available for many operating systems, allowing
Python code to run on a wide variety of systems. CPython, the reference
implementation of Python, is open source software and has a community-based
development model, as do nearly all of its variant implementations. CPython is
managed by the non-profit Python Software Foundation
5.2 HISTORY
Python was conceived in the late 1980s, and its implementation began in December
1989 [28] by Guido van Rossum at Centrum Wiskunde&Informatica (CWI) in the
Netherlands as a successor to the ABC language (itself inspired by SETL) capable of
exception handling and interfacing with the operating system Amoeba. Van Rossum is
Python's principal author, and his continuing central role in deciding the direction of
Python is reflected in the title given to him by the Python community, benevolent dictator
for life (BDFL).
About the origin of Python, Van Rossum wrote in 1996: Over six years ago, in
December 1989, I was looking for a "hobby" programming project that would keep me
occupied during the week around Christmas. My office ... would be closed, but I had a
home computer, and not much else on my hands. I decided to write an interpreter for
the new scripting language I had been thinking about lately: a descendant of ABC that
would appeal to Unix/C hackers. I chose Python as a working title for the project, being
in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus). Python 2.0
was released on 16 October 2000 and had many major new features, including a
cycle-detecting garbage collector and support for Unicode. With this release the
development process was changed and became more transparent and
community-backed. Python 3.0 (which early in its development was commonly referred
to as Python 3000 or py3k), a major, backwards-incompatible release, was released on
3 December 2008 after a long period of testing.
Many of its major features have been backported to the backwards-compatible Python
2.6.xand 2.7.x version series. The End Of Life date (EOL, sunset date) for Python 2.7
was initially set at 2015, then postponed to 2020 out of concern that a large body of
existing code cannot easily be forward-ported to Python 3. In January 2017, Google
announced work on a Python 2.7 to go transcompiler, which The Register speculated
was in response to Python 2.7's planned end-of-life but Google cited performance under
concurrent workloads as their only motivation.
Features and philosophy Python is a multi-paradigm programming language:
object-oriented programming and structured programming are fully supported, and
many language features support functional programming and aspect-oriented
programming (including by metaprogramming and metaobjects (magic methods)). Many
other 6/13/2017 Python (programming language) paradigms are supported via
extensions, including design by contract and logic programming. Python uses dynamic
typing and a mix of reference counting and a cycle-detecting garbage collector for
13
memory management. An important feature of Python is dynamic name resolution (late
binding), which binds method and variable names during program execution.
The design of Python offers some support for functional programming in the Lisp
tradition. The language has map(), reduce() and filter() functions; list comprehensions,
dictionaries, and sets; and generator expressions. The standard library has two
modules (itertools and functools) that implement functional tools borrowed from Haskell
and Standard ML.
The core philosophy of the language is summarized by the document The Zen of
Python (PEP 20), which includes aphorisms such as: Beautiful is better than ugly
Explicit is better than implicit Simple is better than complex Complex is better than
complicated Readability counts Rather than requiring all desired functionality to be built
into the language's core, Python was designed to be highly extensible. Python can also
be embedded in existing applications that need a programmable interface.
This design of a small core language with a large standard library and an easily
extensible interpreter was intended by Van Rossum from the start because of his
frustrations with ABC, which espoused the opposite mindset. While offering choice in
coding methodology, the Python philosophy rejects exuberant syntax, such as in Perl, in
favor of a sparser, less-cluttered grammar.
As Alex Martelli put it: "To describe something as clever is not considered a compliment
in the Python culture." Python's philosophy rejects the Perl "there is more than one way
to do it" approach to language design in favor of "there should be one—and preferably
only one—obvious way to do it". Python's developers strive to avoid premature
optimization, and moreover, reject patches to non-critical parts of CPython that would
offer a marginal increase in speed at the cost of clarity.When speed is important, a
Python programmer can move time-critical functions to extension modules written in
languages such as C, or try using PyPy, a just-in-time compiler. Cython is also
available, which translates a Python script into C and makes direct C-level API calls into
the Python interpreter. An important goal of Python's developers is making it fun to use.
This is reflected in the origin of the name, which comes from Monty Python, and in an
occasionally playful approach to tutorials and reference materials, such as using
examples that refer to spam and eggs instead of the standard foo and bar. A common
neologism in the Python community is pythonic, which can have a wide range of
meanings related to program style.
To say that code is pythonic is to say that it uses Python idioms well, that it is natural or
shows fluency in the language, that it conforms with Python's minimalist philosophy and
emphasis on readability. In contrast, code that is difficult to understand or reads like a
rough transcription from another programming language is called unpythonic. Users and
admirers of Python, especially those considered knowledgeable or experienced, are
often referred to as Pythonists, Pythonistas, and Pythoneers. The third slice parameter,
called step or stride, allows elements to be skipped and reversed. Slice indexes may be
omitted, for example a[:] returns a copy of the entire list. Each element of a slice is a
shallow copy. In Python, a distinction between expressions and statements is rigidly
enforced, in contrast to languages such as Common Lisp, Scheme, or Ruby. This leads
to duplicating some functionality.
14
For example: List comprehensions vs. for-loops Conditional expressions vs. if blocks
The eval() vs. exec() built-in functions (in Python 2, exec is a statement); the former is
for expressions, the latter is for statements. 6/13/2017 Python (programming language)
- Statements cannot be a part of an expression, so list and other comprehensions or
lambda expressions, all being expressions, cannot contain statements.
A particular case of this is that an assignment statement such as a = 1 cannot form part
of the conditional expression of a conditional statement. This has the advantage of
avoiding a classic C error of mistaking an assignment operator = for an equality
operator == in conditions: if (c = 1) { ... } is syntactically valid (but probably unintended)
C code but if c = 1: ... causes a syntax error in Python. Methods Methods on objects are
functions attached to the object's class; the syntax instance.method(argument) is, for
normal methods and functions, syntactic sugar for Class.method(instance, argument).
Python methods have an explicit self parameter to access instance data, in contrast to
the implicit self (or this) in some other object-oriented programming languages (e.g.,
C++, Java, Objective-C, or Ruby). Typing Python uses duck typing and has typed
objects but untyped variable names. Type constraints are not checked at compile time;
rather, operations on an object may fail, signifying that the given object is not of a
suitable type. Despite being dynamically typed, Python is strongly typed, forbidding
operations that are not well-defined (for example, adding a number to a string) rather
than silently attempting to make sense of them. Python allows programmers to define
their own types using classes, which are most often used for objectoriented
programming.
New instances of classes are constructed by calling the class (for example,
SpamClass() or EggsClass()), and the classes are instances of the metaclass type
(itself an instance of itself), allowing meta programming and reflection. Before version
3.0, Python had two kinds of classes: old-style and new-style. The syntax of both styles
is the same, the difference being whether the class object is inherited from, directly or
indirectly (all new-style classes inherit from object and are instances of type). In
versions of Python 2 from Python 2.2 onwards, both kinds of classes can be used.
Old-style classes were eliminated in Python 3.0. The long term plan is to support
gradual typing and as of Python 3.5, the syntax of the language allows specifying static
types but they are not checked in the default implementation, CPython. An experimental
optional static type checker named mypy supports compile-time type checking.
Mathematics Python has the usual C arithmetic operators (+, -, *, /, %). It also has ** for
exponentiation, e.g. 5**3 == 125 and 9**0.5 == 3.0, and a new matrix multiply @
operator is included in version 3.5. [71] Additionally, it has a unary operator (~), which
essentially inverts all the bytes of its one argument. For integers, this means ~x=-x-1.
Other operators include bitwise shift operators x << y, which shifts x to the left y places,
the same as x*(2**y) , and x >> y, which shifts x to the right y places, the same as
x/(2**y) . [73] The behavior of division has changed significantly over time: Python 2.1
and earlier use the C division behavior. The / operator is integer division if both
operands are integers, and floating-point division otherwise. Integer division rounds
towards 0, e.g. 7 / 3 == 2 and -7 / 3 == -2. Python 2.2 changes integer division to round
towards negative infinity, e.g. 7 / 3 == 2 and -7 / 3 == -3. The floor division // operator is
introduced. So 7 // 3 == 2, -7 // 3 == -3, 7.5 // 3 == 2.0 and 6/13/2017 Python
15
(programming language) – Wikipedia
https://en.wikipedia.org/wiki/Python_(programming_language) 8/19 -7.5 // 3 == -3.0.
Adding from __future__ import division causes a module to use Python 3.0 rules for
division (see next). Python 3.0 changes / to be always floating-point division. In Python
terms, the pre-3.0 / is classic division, the version-3.0 / is real division, and // is floor
division. Rounding towards negative infinity, though different from most languages, adds
consistency. For instance, it means that the equation (a+b) // b == a // b + 1 is always
true. It also means that the equation b * (a // b) + a % b == a is valid for both positive
and negative values of a. However, maintaining the validity of this equation means that
while the result of a % b is, as expected, in the half-open interval [0, b), where b is a
positive integer, it has to lie in the interval (b, 0] when b is negative. Python provides a
round function for rounding a float to the nearest integer. For tie-breaking, versions
before 3 use round-away-from-zero: round(0.5) is 1.0, round(-0.5) is −1.0. Python 3
uses round to even: round(1.5) is 2, round(2.5) is 2. Python allows boolean expressions
with multiple equality relations in a manner that is consistent with general use in
mathematics.
For example, the expression a < b < c tests whether a is less than b and b is less than
c. Cderived languages interpret this expression differently: in C, the expression would
first evaluate a < b, resulting in 0 or 1, and that result would then be compared with c.
Python has extensive built-in support for arbitrary precision arithmetic. Integers are
transparently switched from the machine-supported maximum fixed-precision (usually
32 or 64 bits), belonging to the python type int, to arbitrary precision, belonging to the
python type long, where needed. The latter have an "L" suffix in their textual
representation. (In Python 3, the distinction between the int and long types was
eliminated; this behavior is now entirely contained by the int class.) The Decimal
type/class in module decimal (since version 2.4) provides decimal floating point
numbers to arbitrary precision and several rounding modes.The Fraction type in module
fractions (since version 2.6) provides arbitrary precision for rational numbers.
Due to Python's extensive mathematics library, and the third-party library NumPy which
further extends the native capabilities, it is frequently used as a scientific scripting
language to aid in problems such as numerical data processing and manipulation.
Libraries Python has a large standard library, commonly cited as one of Python's
greatest strengths, providing tools suited to many tasks. This is deliberate and has been
described as a "batteries included” Python philosophy.
5.3 OPENCV
OpenCV (Open source computer vision) is a library of programming functions mainly
aimed at real-time computer vision. Originally developed by Intel, it was later supported
by Willow Garage then Itseez (which was later acquired by Intel). The library is
cross-platform and free for use under the open-sourceBSD license.
OpenCV supports the deep learning frameworks TensorFlow, Torch/PyTorch and Caffe
16
5.3.1 History:
Officially launched in 1999 the OpenCV project was initially an Intel Research initiative
to advance CPU-intensive applications, part of a series of projects including real-timeray
tracing and 3D display walls. The main contributors to the project included a number of
optimization experts in Intel Russia, as well as Intel's Performance Library Team. In the
early days of OpenCV, the goals of the project were describedas:
● Advance vision research by providing not only open but also optimized code for
basic vision infrastructure. No more reinventing the wheel.
● Disseminate vision knowledge by providing a common infrastructure that
developers could build on, so that code would be more readily readable and
transferable.
● Advance vision-based commercial applications by making portable,
performance-optimized code available for free – with a license that did not
require code to be open or free itself.
The first alpha version of OpenCV was released to the public at the IEEE Conference
on Computer Vision and Pattern Recognition in 2000, and five betas were released
between 2001 and 2005. The first 1.0 version was released in 2006. A version 1.1
"pre-release" was released in October 2008.
The second major release of the OpenCV was in October 2009. OpenCV 2 includes
major changes to the C++ interface, aiming at easier, more type-safe patterns, new
functions, and better implementations for existing ones in terms of performance
(especially on multi-core systems). Official releases now occur every six months] and
development is now done by an independent Russian team supported by commercial
corporations.
In August 2012, support for OpenCV was taken over by a non-profit foundation
OpenCV.org, which maintains a developer and user site.
On May 2016, Intel signed an agreement to acquire Itseez, a leading developer of
OpenCV.
5.3.2 Applications:
OpenCV's application areas include:
17
● Structure from motion (SFM)
● Motion tracking
● Augmented reality
To support some of the above areas, OpenCV includes a statistical machine learning
library that contains:
● Boosting
● Decision tree learning
● Gradient boosting trees
● Expectation-maximization algorithm
● k-nearest neighbor algorithm
● Naive Bayes classifier
● Artificial neural networks
● Random forest
● Support vector machine (SVM)
● Deep neural networks (DNN)
18
5.5 What is OCR?
Purpose of OCR
OCR is a technology that enables you to convert different types of documents, such
as scanned paper documents, PDF files, or images captured by a digital camera
into editable and searchable data.
What is EasyOCR?
Fig.No.5.1:EasyOCR Framework
Table of content
19
o Through URL
o Locally
4. Extracting text from the image
o With GPU
o Without GPU
o English text
o Turkish text and other languages
5. Drawing results on images
o Example 1
o Example 2
o Dealing with multiple lines of text
● Pytorch
20
Fig.No.5.2:PyTorch
21
Fig.No.5.3:Installing pip Torch
● EasyOCR
After installing the PyTorch library successfully it’s quite easy to install the
EasyOCR library, one just has to run the following command:
22
Fig.No.5.4 : Installing Easyocr
2. Importing Libraries
Importos
Importeasyocr
import cv2
frommatplotlib import pyplot as plt
importnumpy as np
3. Reading images
● Taking an online image: Here we will take an image from a URL. (online)
IMAGE_PATH='https://blog.aspose.com/wpcontent/uploads/sites/2/2020/05/Perform-OC
R-using-C.jpg'
In the above code snippet, one can notice that the IMAGE_PATH holds the URL of the
image.
● Taking image as input locally: Here we will take an image from the local system.
IMAGE_PATH = 'Perform-OCR.jpg'
In the above code snippet, one can notice that I have taken the image locally i.e. from
the local system.
23
4. Extracting text from the image
reader = easyocr.Reader(['en'])
result = reader.readtext(IMAGE_PATH,paragraph="False")
result
Output:
Fig.No.5.5: OCR
1. Here, we are using the Reader class from easyocrclass and then passing [‘en’] as an
attribute which means that now it will only detect the English part of the image as text, if
it will find other languages like Chinese and Japanese then it will ignore those text.
2. Now, as in the above line, we have set the attribute for language so, here we are
loading the IMAGE_PATH in the readText() function and one will find out a parameter
which is “paragraph” here it is set as False which means that now easyOCR will not
24
combine the results i.e. if easyocr will encounter multiple texts it will not combine them
instead it will show them separately.
25
Fig.No.5.6:Common Text
Afrikaans (af), Azerbaijani (az), Bosnian (bs), Czech (cs), Welsh (cy), Danish (da),
German (de), English (en), Spanish (es), Estonian (et), French (fr), Irish (ga), Croatian
(hr), Hungarian (hu), Indonesian (id), Icelandic (is), Italian (it), Japanese (ja), Korean
(ko), Kurdish (ku), Latin (la), Lithuanian (lt), Latvian (lv), Maori (mi), Malay (ms), Maltese
(mt), Dutch (nl), Norwegian (no), Polish (pl), Portuguese (pt),Romanian (ro), Slovak (sk),
Slovenian (sl), Albanian (sq), Swedish (sv),Swahili (sw), Thai (th), Tagalog (tl), Turkish
(tr), Uzbek (uz), Vietnamese (vi), Chinese (zh) – Source: JaidedAI
EasyOCR provides enough flexibility to choose Text detection with GPU or without.
26
# Changing the image path
IMAGE_PATH = 'Turkish_text.png'
reader = easyocr.Reader(['en'])
result = reader.readtext(IMAGE_PATH)
result
Output:
27
'follow',
0.9879666041306504),
([[353, 703], [483, 703], [483, 748], [353, 748]],
'takip et',
0.9987622244733467)]
● Extracting text from image without GPU
[([[95, 71], [153, 71], [153, 107], [95, 107]], 'OCR', 0.990493426051807)]
# Where 0.9904..is the confidence level of detection
Note: If you don’t have the GPU and yet you are not setting it as False then you will get
the following warning:
top_left = tuple(result[0][0][0])
bottom_right = tuple(result[0][0][2])
text = result[0][1]
font = cv2.FONT_HERSHEY_SIMPLEX
In the above code snippet,
1. We are trying to get the coordinates to draw the bounding box and text over our
image on which we have to perform our detection.
28
2. In the top_left variable, we are getting the coordinate of the top_left corner in
the form of tuple accessing from results. Similarly, we can see that in
the bottom_right coordinate.
3. Getting the coordinate of text from 2-d array format
4. Choosing font of text as FONT_HERSHEY_SIMPLEX from cv2 package.
img = cv2.imread(IMAGE_PATH)
img = cv2.rectangle(img,top_left,bottom_right,(0,255,0),3)
img = cv2.putText(img,text,bottom_right, font, 0.5,(0,255,0),2,cv2.LINE_AA)
plt.figure(figsize=(10,10))
plt.imshow(img)
plt.show()
Now, as if we have got the coordinates let’s just plot them!
Output:
29
5.8: Draw Results for single-line text
IMAGE_PATH = 'sign.png'
reader = easyocr.Reader(['en'], gpu=False)
result = reader.readtext(IMAGE_PATH)
result
Output:
30
Getting the coordinates
top_left = tuple(result[0][0][0])
bottom_right = tuple(result[0][0][2])
text = result[0][1]
font = cv2.FONT_HERSHEY_SIMPLEX
Drawing text and bounding boxes
img = cv2.imread(IMAGE_PATH)
img = cv2.rectangle(img,top_left,bottom_right,(0,255,0),3)
img = cv2.putText(img,text,top_left, font, 0.5,(0,0,255),2,cv2.LINE_AA)
plt.figure(figsize=(10,10))
plt.imshow(img)
plt.show()
Output:
31
img = cv2.rectangle(img,top_left,bottom_right,(0,255,0),3)
img = cv2.putText(img,text,(20,spacer), font, 0.5,(0,255,0),2,cv2.LINE_AA)
spacer+=15
plt.figure(figsize=(10,10))
plt.imshow(img)
plt.show()
In the above code snippet, we just need to focus on few points:
1. Instead of detecting one-line text, here we are looping through all the detection
as we want to plot multiple lines of text
2. While giving the coordinates on cv2.putText we are using an extra variable which
is “spacer” this spacer later in the code is being incremented to +15 which is
helping to restrict the text to collide over each other.
3. This spacer variable will help the text to remain sorted and equally spaced.
Output:
CHAPTER 6
32
Fig.No.6.1:Code File
33
Fig.No.6.2: Input Image
34
Fig.No.6.3:Gray Scale Conversion
35
Fig.No.6.4: Bilateral Filter Image
36
Fig.No.6.6: Detecting License Plate Number
37
Fig.No.6.8: Result Stored In Excel Sheet
CHAPTER 7
License Plate Recognition was 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 conclusion 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 in CNN algorithm and 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.
38
REFERENCE:
[1] Martin, F., Garcia, M., Alba, J.L. New methods for automatic reading of VLP's
(Vehicle License Plates) (2002) Proc. IASTED Int. Conf. SPPRA,
[2] Hongliang, B., Changping, L. A hybrid license plate extraction method based on
edge statistics and morphology (2004) Proc. ICPR, pp. 831-834.
[3] Zheng, D., Zhao, Y., Wang, J. An efficient method of license plate location (2005)
Pattern Recognit. Lett, 26 (15), pp. 2431-2438. Nov
[4] Wang, S., Lee, H. Detection and recognition of license plate characters with different
appearences (2003) Proc. Conf. Intell. Transp. Syst, 2, pp. 979-984.
[5] Lee, H.-J., Chen, S.-Y., Wang, S.-Z. Extraction and recognition of license plates of
motorcycles and vehicles on highways (2004) Proc. ICPR, pp. 356-359.
[6] Comelli, P., Ferragina, P., Granieri, M.N., Stabile, F. Optical recognition of motor
vehicle license plates (1995) IEEE Trans. Veh. Technol, 44 (4), pp. 790-799. Nov
[7] Shi, X., Zhao, W., Shen, Y. (2005) Automatic License Plate Recognition System
Based on Color Image Processing, 3483, pp. 1159-1168. O. Gervasi et al, Ed. New
York: Springer-Verlag
[8] Kim, K.I., Jung, K., Kim, J.H. Color Texture-Based Object Detection: An Application
to License Plate Localization, 2388, pp. 293-309. S.-W. Lee and A. Verri, Eds. New
York: Springer-Verlag, pp
[9] Zhong, Y., Jain, A.K. Object localization using color, texture and shape (2000)
Pattern Recognit, 33 (4), pp. 671-684. Apr
39
[10] Mirmehdi, M., Petrou, M. Segmentation of color textures (2000) IEEE Trans.
Pattern Anal. Mach. Intell, 22 (2), pp. 142-159. Feb
[11] Kim, K.I., Jung, K., Park, S.H., Kim, H.J. Support vector machines for texture
classification (2002) IEEE Trans. Pattern Anal. Mach. Intell, 24 (11), pp. 1542-1550. Nov
[12] Osuna, E., Freund, R., Girosi, F. Training support vector machines: An application
to face detection (1997) Proc. IEEE Conf. CVPR, pp. 130-136.
[13] San Juan, Puerto Rico, Bradski, G.R. Real time face and object tracking as a
component of a perceptual user interface (1998) Proc. IEEE Workshop Appl. Comput.
Vis, pp. 214-219.
[14] Sarasota, FL, Draghici, S. A neural network based artificial vision system for license
plate recognition (1997) Int. J. Neural Syst, 8 (1), pp. 113-126. Feb
[15] Broumandnia, A., Fathy, M. Application of pattern recognition for Farsi license plate
recognition (2005) Proc. Int. Conf. GVIP, Cairo, Egypt [16] Wang, T.-H., Ni, F.-C., Li,
K.-T., Chen, Y.-P. Robust license plate recognition based on dynamic projection warping
(2004) Proc. IEEE Int. Conf. Netw., Sens. Control, pp. 784-788.
[17] Cano, J., Perez-Cortes, J.C. (2003) Vehicle License Plate Segmentation in Natural
Images, 2652, pp. 142-149. F. J. Perales etal, Eds. New York: Springer-Verlag
[18] Zimic, N., Ficzko, J., Mraz, M., Virant, J. The fuzzy logic approach to the car
number plate locating problem (1997) Proc. IIS, pp. 227-230. Grand Bahama Island,
The Bahamas
[19] Nijhuis, J.A.G., terBrugge, M.H., Helmholt, K.A., Pluim, J.P.W., Spaanenburg, L.,
Venema, R.S., Westenberg, M.A. Car license plate recognition with neural networks and
fuzzy logic (1995) Proc. IEEE Int. Conf. Neural Netw, 5, pp. 2232-2236.
[20] Chang, S.-L., Chen, L.-S., Chung, Y.-C., Chen, S.-W. Automatic license plate
recognition (2004) IEEE Trans. Intell. Transp. Syst, 5 (1), pp. 42-53. Mar
[21] Kahraman, F., Kurt, B., Gökmen, M. (2003) License Plate Character Segmentation
Based on the Gabor Transform and Vector Quantization, 2869, pp. 381-388. A. Yazici
and C. Sener, Eds. New York: Springer-Verlag
[22] Adorni, G., Cagnoni, S., Mordonini, M. Efficient low-level vision program design
using sub-machine-code genetic programming (2002) Proc. Workshop sullaPercezione
e VisionenelleMacchine,
[23] Yoshimori, S., Mitsukura, Y., Fukumi, M., Akamatsu, N. (2003) License Plate
Detection Using Hereditary Threshold Determine Method, 2773, pp. 585-593. V. Palade,
R. J. Howlett, and L. C. Jain, Eds. New York: Springer-Verlag
[24] Cui, Y., Huang, Q. Extracting characters of license plates from video sequences
(1998) Mach. Vis. Appl, 10 (5-6), pp. 308-320. Apr
40
[25] Duan, T.D., Du, T.L.H., Phuoc, T.V., Hoang, N.V. Building an automatic vehicle
license-plate recognition system (2005) Proc. Int. Conf. Comput. Sci. (RIVF), pp. 59-63.
[26] Hsieh, C.-T., Juan, Y.-S., Hung, K.-M. Multiple license plate detection for complex
background (2005) Proc. Int Conf. AINA, 2, pp. 389-392.
[27] Kim, D.-S., Chien, S.-I. Automatic car license plate extraction using modified
generalized symmetry transform and image warping (2001) Proc. ISIE, pp. 2022-2027.
[28] Dlagnekov, L. (2004) License Plate Detection Using AdaBoost, Mar, San Diego,
CA: Comput. Sci. Eng. Dept, Univ. California, San Diego, Online, Available
[29] terBrugge, M.H., Stevens, J.H., Nijhuis, J.A.G., Spaanenburg, L. License plate
recognition using DTCNNs (1998) Proc. IEEE Int. Workshop Cellular NNs Appl, pp.
212-217.
[30] terBrugge, M.H., Nijhuis, J.A.G., Spaanenburg, L. Transformational DT-CNN design
from morphological specifications (1998) IEEE Trans. Circuits Syst. I, Fundam. Theory
Appl, 45 (9), pp. 879-888. Sep
[31] Chacon, M.I., Zimmerman, A. License plate location based on a dynamic PCNN
scheme (2003) Proc. Int. Joint Conf. Neural Netw, 2, pp. 1195-1200.
[32] Kim, K.K., Kim, K.I., Kim, J.B., Kim, H.J. Learning-based approach, for license plate
recognition (2000) Proc. IEEE Signal Process. Soc. Workshop, NNs Signal Process, 2,
pp. 614-623.
[33] Zunino, R., Rovetta, S. Vector quantization for license-plate location and image
coding (2000) IEEE Trans. Ind. Electron, 47 (1), pp. 159-167. Feb
[34] Gray, R.M. Vector quantization (1984) IEEE ASSP Mag, 1 (2), pp. 4-29. Apr
[35] Nasrabadi, N., King, R. Image coding using vector quantization: A review (1988)
IEEE Trans. Commun, 36 (8), pp. 957-971. Aug
[36] Ridella, S., Rovetta, S., Zunino, R. Plastic algorithm for adaptive vector quantization
(1998) Neural Comput. Appl, 7 (1), pp. 37-51. Mar
[37] Naito, T., Tsukada, T., Yamada, K., Kozuka, K., Yamamoto, S. Robust license-plate
recognition method for passing vehicles under outside environment (2000) IEEE Trans.
Veh. Technol, 49 (6), pp. 2309-2319. Nov
[38] Otsu, N. A threshold selection method from gray-level histograms (1979) IEEE
Trans. Syst., Man, Cybern, SMC-9 (1), pp. 62-66. Jan
[39] Anagnostopoulos, C., Anagnostopoulos, I., Kayafas, E., Loumos, V. A license plate
recognition system for intelligent transportation system applications (2006) IEEE Trans.
Intell. Transp. Syst, 7 (3), pp. 377-392. Sep
41
[40] Anagnostopoulos, C., Alexandropoulos, T., Boutas, S., Loumos, V., Kayafas, E. A
template-guided approach to vehicle surveillance and access control (2005) Proc. IEEE
Conf. Advanced Video Signal Based Surveillance, pp. 534-539.
[41] Anagnostopoulos, C., Anagnostopoulos, I., Vergados, D., Kayafas, E., Loumos, V.
Sliding windows: A software method for real-time inspection in textile surface (2004)
Textile Res. J, 74 (7), pp. 646-651. Jul
[42] Sauvola, J., Pietikäinen, M. Adaptive document image binarization (2000) Pattern
Recognit, 33 (2), pp. 225-236. Feb
[43] Cao, G., Chen, J., Jiang, J. An adaptive approach to vehicle license plate
localization (2003) Proc. 29th Annu. Conf. IECON, pp. 1786-1791.
[44] Yang, F., Ma, Z. Vehicle license plate location based on histogramming and
mathematical morphology (2005) Proc. 4th IEEE Workshop Autom. Identification
Advanced Technol, pp. 89-94.
[45] Suryanarayana, P.V., Mitra, S.K., Baneree, A., Roy, A.K. A morphology based
approach for car license plate extraction (2005) Proc. IEEE Indicon, pp. 24-27.Chennai,
India, Dec
[46] Xiong, J., Du, S., Gao, D., Shen, Q. Locating car license plate under various
illumination conditions using genetic algorithm Proc. ICSP, pp. 2502-2505.
[47] Kim, S.K., Kim, D.W., Kim, H.J. A recognition of vehicle license plate using a
genetic algorithm based segmentation (1996) Proc. Int. Conf. Image Process, 1, pp.
661-664. Sep
[48] Kamat, V., Ganesan, S. An efficient implementation of the Hough transform for
detecting vehicle license plates using DSP'S (1995) Proc. Real-Time Technol. Appl.
Symp, pp. 58-59. May 15-17
[49] Cheng, Y., Lu, J., Yahagi, T. Car license plate recognition based on the combination
of principal component analysis and radial basis function networks Proc. ICSP, pp.
1455-1458.
[50] Jung, C.R., Schramm, R. Rectangle detection based on a windowed Hough
transform (2004) Proc. 17th SIBGRAPI, pp. 113-120.
[51] Lee, E.R., Kim, P.K., Kim, H.J. Automatic recognition of a car license plate using
color image processing (1994) Proc. IEEE ICIP, 2, pp. 301-305. Nov. 13-16
[52] Nomura, S., Yamanaka, K., Katai, O., Kawakami, H., Shiose, T. A novel adaptive
morphological approach for degraded character image segmentation (2005) Pattern
Recognit, 38 (11), pp. 1961-1975. Nov
42
[53] Nomura, S., Yamanaka, K., Katai, O., Kawakami, H. A new method for degraded
color image binarization based on adaptive lightning on grayscale versions (2004)
IEICE Trans. Inf. Syst, E87-D (4), pp. 1012-1020. Apr
[54] Soille, P. (1999) Morphological Image Analysis: Principles and Applications, Berlin,
Germany: Springer-Verlag
[55] Gonzalez, R.C., Woods, R.E. (1993) Digital Image Processing, Reading. MA:
Addison-Wesley [56] Mardia, K.V., Hainsworth, T.J. A spatial thresholding method for
image segmentation (1988) IEEE Trans. Pattern Anal. Mach. Intell, 10 (6), pp. 919-927.
Nov
[57] Rudolph, G. Convergence analysis of canonical genetic algorithms (1994) IEEE
Trans. Neural Netw, 5 (1), pp. 96-101. Jan
[58] Grimson, W.E.L., Lozano-Perez, T. Localizing overlapping parts by searching the
interpretation tree (1987) IEEE Trans. Pattern Anal. Mach. Intell, PAMI-9 (4), pp.
469-482. Jul
[59] Lee, B.R., Park, K., Kang, H., Kim, H., Kim, C. (2004) Adaptive Local Binarization
Method for Recognition of Vehicle License Plates, 3322, pp. 646-655. R. Klette and J.
Žunić, Eds. New York: Springer-Verlag
[60] Perez, A., Gonzalez, R.C. An iterative thresholding algorithm for image
segmentation (1987) IEEE Trans. Pattern Anal. Mach. Intell, PAMI-9 (6), pp. 742-751.
Nov
[61] Parker, J.R. Gray level thresholding in badly illuminated images (1991) IEEE Trans.
Pattern Anal. Mach. Intell, 13 (8), pp. 813-819. Aug
[62] Nakagawa, Y., Rosenfeld, A. Some experiments on variable thresholding (1979)
Pattern Recognit, 11 (3), pp. 191-204.
[63] Kittler, J., Illingworth, J., Foglein, J. Threshold selection based on a simple image
statistic (1985) Comput. Vis. Graph. Image Process, 30 (2), pp. 125-147. May
[64] Kim, K.B., Jang, S.W., Kim, C.K. Recognition of car license plate by using
dynamical thresholding method and enhanced neural networks (2003) Computer
Analysis of Images and Patterns, 2756, pp. 309-319. N. Petkov and M. A. Westenberg,
Eds. New York: Springer-Verlag
[65] Llorens, D., Marzal, A., Palazon, V., Vilar, J.M. (2005) Car License Plates Extraction
and Recognition Based on Connected Components Analysis and HMM Decoding, 3522,
pp. 571-578. J. S. Marques et al, Eds. New York: SpringerVerlag
[66] Rabiner, L.R. A tutorial on hidden Markov models and selected applications in
speech recognition (1989) Proc. IEEE, 77 (2), pp. 257-286. Feb
43
[67] Haykin, S. (1999) Neural Networks: A Comprehensive Foundation, 2nd ed.
Englewood Cliffs, NJ: Prentice-Hall
[68] Lim, E.K., Yang, H.K., Kim, K.B. Recognition of car license plate using Kohonen
algorithm (2000) Proc. ITC-CSCC, 2, pp. 785-788.
[69]Anagnostopoulos, C., Kayafas, E., Loumos, V. Digital image processing and neural
networks for vehicle license plate identification (2000) J. Electr. Eng, 1 (2), pp. 2-7.
[70] Specht, D.F. Probabilistic neural networks (1990) Neural Netw, 3 (1), pp. 109-118.
[71] Bishop, C.M. (1997) Neural Networks for Pattern Recognition, New York: Oxford
Univ. Press
[72] Anagnostopoulos, C., Anagnostopoulos, I., Tsekouras, G., Kouzas, G., Loumos, V.,
Kayafas, E. Using sliding concentric windows for license plate segmentation and
processing (2005) Proc. IEEE Workshop Signal Process. Syst. Des. Implementation,
pp. 337-342. Athens, Greece
[73] Hu, Y., Zhu, F., Zhang, X. (2005) A Novel Approach for License Plate Recognition
Using Subspace Projection and Probabilistic Neural Network, 3497, pp. 216-221. J.
Wang, X. Liao, and Z. Yi, Eds. New York: Springer-Verlag
[74] Huttenlokcer, D.P., Klanderman, G.A., Rucklidge, W.J. Comparing images using the
Hausdorff distance (1993) IEEE Trans. Pattern Anal. Mach. Intell, 15 (9), pp. 850-863.
Sep
[75] Rucklidge, J. Efficiently locating objects using the Hausdorff distance (1997) Int. J.
Comput. Vis, 24 (3), pp. 251-270. Sep./Oct
[76] Huang, Y.-P., Lai, S.-Y., Chuang, W.-P. A template-based model for license plate
recognition (2004) Proc. IEEE Int. Conf. Netw., Sens. Control, pp. 737-742.
[77] Wu, C., On, L.C., Weng, C.H., Kuan, T.S., Ng, K. A Macao license plate recognition
system (2005) Proc. 4th Int. Conf. Mach. Learn. Cybern, pp. 4506-4510. Guangzhou,
China, Aug. 18-21
[78] Bellas, N., Chai, S.M., Dwyer, M., Linzmeier, D. FPGA implementation of a license
plate recognition SoC using automatically generated streaming accelerators (2006)
Proc. 20th IPDPS, pp. 8-15. Nice, France, Apr
[79] Oz, C., Ercal, F. A practical license plate recognition system for real-time
environments (2005) Proc. IWANN, 3512, pp. 881-888. Berlin, Germany:
Springer-Verlag
[80] Zhang, P., Chen, L.H. A novel feature extraction method and hybrid tree
classification for handwritten numeral recognition (2002) Pattern Recognit. Lett, 23
(1-3), pp. 45-56. Jan
44
[81] Kittler, J., Mohamad, H., Robert, P.W. On combining classifiers (1998) IEEE Trans.
Pattern Anal. Mach. Intell, 3 (20), pp. 226-239. Mar
[82] Ahmad, C.J., Shridhar, M. Recognition of handwritten numerals with multiple
feature and multistage classifier (1995) Pattern Recognit, 2 (28), pp. 153-160. Feb
[83] Krzyzak, L.X.A., Suen, C.Y. Methods of combining multiple classifiers and their
application to handwriting recognition (1992) IEEE Trans. Syst., Man, Cybern, 22 (3),
pp. 418-435. May/Jun
[84] Huang, Y.S., Suen, C.Y. A method of combining multiple experts for the recognition
of unconstrained handwritten numerals (1995) IEEE Trans. Pattern Anal. Mach. Intell,
17 (1), pp. 90-93. Jan
[85] Kang, H.J., Kim, J. Probabilistic framework for combining multiple classifier at
abstract level (1997) Proc. 4th Int. Conf. Document Anal. Recog, 1, pp. 870-874. Ulm,
Germany, Aug
[86] Pan, X., Ye, X., Zhang, S. A hybrid method for robust car plate character
recognition (2005) Eng. Appl. Artif. Intell, 18 (8), pp. 963-972. Dec
[87] Kong, J., Liu, X., Lu, Y., Zhou, X. A novel license plate localization method based
on textural feature analysis (2005) Proc. IEEE Int. Symp. Signal Process. Inf. Technol,
pp. 275-279. Athens. Greece
[88] Li, G., Zeng, R., Lin, L. Research on vehicle license plate location based on neural
networks (2006) Proc. 1st ICICIC, pp. 174-177. Beijing, China
[89] Mahini, H., Kasaei, S., Dorri, F., Dorri, F. An efficient features-based license plate
localization method (2006) Proc. 18th ICPR, 2, pp. 841-844. Hong Kong
[90] Shapiro, V., Gluhchev, G. Multinational license plate recognition system:
Segmentation and classification (2004) Proc. 17th ICPR, 4, pp. 352-355. Cambridge,
U.K
[91] Franc, V., Hlavac, V. (2005) License Plate Character Segmentation Using Hidden
Markov Chains, 3663, pp. 385-392. Berlin, Germany: Springer-Verlag
[92] Schlesinger, M.I., Hlavac, V. (2002) Ten Lectures on Statistical and Structural
Pattern Recognition, Norwell, MA: Kluwer
[93] Cheng, Y. Mean shift, mode seeking, and clustering (1995) IEEE Trans. Pattern
Anal. Mach. Intell, 17 (8), pp. 790-799. Aug
[94] Comaniciu, D., Meer, P. Mean shift: A robust approach toward feature space
analysis (2002) IEEE Trans. Pattern Anal. Mach. Intell, 24 (5), pp. 603-619. May
[95] Jia, W., Zhang, H., He, X., Piccardi, M. Mean shift for accurate license plate
localization (2005) Proc. 8th Int. IEEE Conf. Intell. Transp. Syst, pp. 566-571. Vienna,
Austria, Sep. 13-16
45
[96] Jia, W., Zhang, H., He, X., Wu, Q. Gaussian weighted histogram intersection for
license plate classification (2006) Proc. 18th ICPR, 3, pp. 574-577. Hong Kong
[97] Swain, M.J., Ballard, D.H. Color indexing (1991) Int. J. Comput. Vis, 1 (7), pp.
11-32. Nov
[98] Wong, K.-M., Cheung, C.-H., Po, L.-M. Merged color histogram for color image
retrieval (2002) Proc. Int. Conf. Image Process, 3, pp. 949-952.
[99] Wu, P., Chen, H.-H., Wu, R.-J., Shen, D.-F. License plate extraction in low
resolution video (2006) Proc. 18th ICPR, 1, pp. 824-827. Hong Kong
[100] Kim, S., Kim, D., Ryu, Y., Kim, G. A robust license-plate extraction method under
complex image conditions (2002) Proc. 16th Int. Conf. Pattern Recog, 3, pp. 216-219.
Quebec, QC, Canada
[101] Ma, Z., Yang, J. A license plate locating algorithm based on multiple Gauss filters
and morphology mathematics (2006) Proc. 24th IASTED Int. Multiconference, Signal
Process., PatternRecog. Appl, pp. 90-94. Insbruck, Austria, Feb. 15-17
[102] Chen, Y.-N., Han, C.-C., Wang, C.-T., Jeng, B.-S., Fan, K.-C. The application of a
convolution neural network on face and license plate detection (2006) Proc. 18th ICPR,
3, pp. 552-555. Hong Kong
[103] Garcia, C., Delakis, M. Convolutional face finder: A neural architecture for fast and
robust face detector (2004) IEEE Trans. Pattern Anal. Mach. Intell, 26 (11), pp.
1408-1423. Nov
[104] Rowley, H.A., Baluja, S., Kanade, T. Neural network based face detection (1998)
IEEE Trans. Pattern Anal. Mach. Intell, 20 (1), pp. 23-38. Jan
[105] Deans, S.R. Hough transform from the radon transform (1981) IEEE Trans.
Pattern Anal. Mach. Intell, PAMI-3 (2), pp. 185-188.
[106] Yalçin, I.K., Gökmen, M. Integrating differential evolution and condensation
algorithms for license plate tracking (2006) Proc. 18th ICPR, 1, pp. 658-661. Hong Kong
[107] Isard, M., Blake, A. Condensation - Conditional density propagation for visual
tracking (1998) Int. J. Comput. Vis, 29 (1), pp. 5-28. Aug
[108] Storn, R., Price, K. (1995) Differential evolution - A simple and efficient adaptive
scheme for global optimization over continuous spaces, Int. Comput. Sci. Inst, Berkeley,
CA, Tech. Rep. TR-95-012
[109] Wu, Q., Zhang, H., Jia, W., He, X., Yang, J., Hintz, T. Car plate detection using
cascaded tree-style learner based on hybrid object features (2006) Proc. IEEE Int. Conf.
AVSS, pp. 15-20. Sydney, Australia
[110] Zhang, H., Jia, W., He, X., Wu, Q. Learning-based license plate detection using
global and local features (2006) Proc. 18th ICPR, 2, pp. 1102-1105. Hong Kong
46
[111] Capar, A., Gokmen, M. Concurrent segmentation and recognition with
shape-driven fast marching methods (2006) Proc. 18th ICPR, 1, pp. 155-158. Hong
Kong
[112] Sethian, J.A. A fast marching level set method for monotonically advancing fronts
(1996) Proc. Nat. Acad. Sci, 93, pp. 1591-1595. Feb
[113] Stec, P., Domanski, M. Efficient unassisted video segmentation using enhanced
fast marching Proc. ICIP, 3, pp. 427-430.
[114] Amit, Y., Geman, D., Fan, X. A coarse-to-fine strategy for multi-class shape
detection (2004) IEEE Trans. Pattern Anal. Mach. Intell, 26 (12), pp. 1606-1621. Dec
[115] Amit, Y. A neural network architecture for visual selection (2000) Neural Comput,
12 (5), pp. 1059-1082. May
[116] Amit, Y., Geman, D. A computational model for visual selection (1999) Neural
Comput, 11 (7), pp. 1691-1715. Oct
[117] Pratt, W.K. (2001) Digital Image Processing: PlKS Inside, 3rd ed. Hoboken, NJ:
Wiley
[118] Rumelhart, D.E., McClelland, J.L. Parallel distributed processing (1986)
Explorations in the Microstructure of Cognition, 1-2. Cambridge, MA: MIT Press
[119] Trier, O.D., Jain, A.K., Taxt, T. Feature extraction methods for character
recognition - A survey (1996) Pattern Recognit, 29 (4), pp. 641-661. Apr
[120] Park, S.H., Kim, K.I., Jung, K., Kim, H.J. Locating car license plates using neural
networks (1999) Electron. Lett, 35 (17), pp. 1475-1477. Aug
[121] Waibel, A., Hanazawa, T., Hinton, G., Shikano, K., Lang, K.J. Phoneme
recognition using time-delay neural networks (1989) IEEE Trans. Acoust., Speech
Signal Process, 37 (3), pp. 328-339. Mar
[122] French, A.S., Stein, R.B. A flexible neural analog using integrated circuits (1970)
IEEE Trans. Biomed. Eng, BME-17 (3), pp. 248-337.
[123] Reitboeck, H.J., Eckhorn, R., Arndt, M., Dicke, P. A model of feature linking via
correlated neural activity (1989) Synergetics of Cognition, pp. 112-125. H. Haken, Ed.
New York: Springer-Verlag
[124] Johnson, J.L., Padgett, M.L. PCNN models and applications (1999) IEEE Trans.
Neural Netw, 10 (3), pp. 480-498. May
[125] Taleb-Ahmed, A., Hamad, D., Tilmant, G. Vehicle license plate recognition in
marketing application (2003) Proc. Intell. Vehicles Symp, pp. 90-94.
47
[126] Wei, W., Li, Y., Wang, M., Huang, Z. Research on number-plate recognition based
on neural networks Proc. IEEE Signal Process. Soc. Workshop Neural Netw. Signal
Process. XI, pp. 529-538.
[127] Coetzee, C., Botha, C., Weber, D. PC based number plate recognition system
(1998) Proc. IEEE Int. Symp. Ind. Electron, pp. 605-610.
[128] Lim, B., Yeo, W., Tan, K., Teo, C. A novel DSP based real time character
classification and recognition algorithm for car plate detection and recognition (1998)
Proc. Int. Conf. Signal Process, pp. 1269-1272.
[129] Opas, C., Li, L., Qian, X. Automatic license number extraction and its parallel
implementation (1999) Proc. 25th Annu. Conf. Ind. Electron. Soc, pp. 704-709.
[130] Hegt, H., De la Haye, R., Khan, N. A high performance license plate recognition
system Proc. IEEE Int. Conf. Syst., Man, Cybern, pp. 4357-4362.
[131] Yan, D., Hongqing, M., Jilin, L., Langang, L. A high performance license plate
recognition system based on the web technique (2001) Proc. Conf. Intell. Transp. Syst,
pp. 325-329.
[132] Sirithinaphong, T., Chamnongthai, K. The recognition of car license plate for
automatic parking system (1999) Proc. 5th Int. Symp. Signal Process. Appl, pp.
455-457.
[133] Raus, M., Kreft, L. Reading car license plates by the use of artificial neural
networks (1995) Proc. 38th Midwest Symp. Circuits Syst, pp. 538-541.
[134] Rahman, A., Badawy, W., Radmanesh, A. A real time vehicle's license plate
recognition system Proc. IEEE Conf. Advanced Video Signal Based Surveillance, pp.
163-166.
[135] Sirithinaphong, T., Chamnongthai, K. Extracting of car license plate using motor
vehicle regulation and character pattern recognition Proc. IEEE Asia-Pacific Conf.
Circuits Syst, pp. 559-562.
[136] Grossberg, S. Competitive learning: From interactive activation to adaptive
resonance (1987) Cogn. Sci, 11 (1), pp. 23-63. Jan./Mar
[137] Barroso, J., Dagless, E., Rafael, A., Bulas-Cruz, J. Number plate reading using
computer vision Proc. IEEE Int. Symp. Ind. Electron, pp. 761-766.
[138] Rouhani, M. A fuzzy feature extractor neural network and its application in license
plate recognition (2006) Computational Intelligence, Theory and Application, pp.
223-228. Berlin, Germany: Springer-Verlag, Sep.
[139] Buckley, J., Hayashi, Y. Neural nets for fuzzy systems (1995) Fuzzy Sets Syst, 71
(3), pp. 265-276. May
48
[140] Kwan, H.K., Cai, Y. A fuzzy neural network and its application to pattern
recognition (1994) IEEE Trans. Fuzzy Syst, 2 (3), pp. 185-193. Aug
[141] Petrovic, V.S., Cootes, T.F. Analysis of features for rigid structure vehicle type
recognition (2004) Proc. Brit. Mach. Vis. Conf, 2, pp. 587-596.
[142] Petrovic, V.S., Cootes, T.F. Vehicle type recognition with match refinement (2004)
Proc. 17th Int. Conf. Pattern Recog, 3, pp. 95-98. Aug. 23-26
[143] Lee, H.J. (2006) Neural Network Approach to Identify Model of Vehicles, 3973, pp.
66-72. New York: Springer-Verlag
[144] Chang, T.H., Lin, C.H., Hsu, C.S., Wu, Y.J. A vision-based vehicle behavior
monitoring and warning system (2003) Proc. Intell. Transp. Syst, 1, pp. 448-453.
[145] Garibotto, G. (2001) A Binocular License Plate Reader for High Precision Speed
Measurement, 2059, pp. 749-758. C. Arcelli et al, Eds. Berlin. Germany:
Springer-Verlag
[146] Lee, H., Kim, D., Kim, D., Bang, S.Y. Real-time automatic vehicle management
system using vehicle tracking and car plate number identification Proc. ICME, 2, pp.
II/353-II/356.
[147] Kang, J.S., Kang, M.H., Park, C.H., Kim, J.H., Choi, Y.S. Implementation of
embedded system for vehicle tracking and license plates recognition using spatial
relative distance (2004) Proc. 26th Int. Inf. Technol. Interfaces, 1, pp. 167-172. April 26,
2007,
[148] Anagnostopoulos, C., Alexandropoulos, T., Loumos, V., Kayafas, E. Intelligent
traffic management through MPEG-7 vehicle flow surveillance (2006) Proc. IEEE Int.
Symp. Modem Comput. JVA, pp. 202-207. Oct
[149] Porikli, F., Kocak, T. Robust license plate detection using covariance descriptor in
a neural network framework Proc. IEEE Int. Conf. AVSS, pp. 107-112.
[150] Suresh, K.V., Mahesh Kumar, G., Rajagopalan, A.N. Superresolution of license
plates in real traffic videos (2007) IEEE Trans. Intell. Transp. Syst, 8 (2), pp. 321-331.
Jun
[151] Arth, C., Limberger, F., Bischof, H. Real-time license plate recognition on an
embedded DSP-platform (2007) Proc. IEEE Conf. CVPR, pp. 1-8. Jun. 17-22
[152] Shapiro, V., Gluhchev, G., Dimov, D. Towards a multinational car license plate
recognition system (2006) Mach. Vis. Appl, 17 (3), pp. 173-183. Aug
[153] Mecocci, A., Tommaso, C. Generative models for license plate recognition by
using a limited number of training samples (2006) Proc. IEEE Int. Conf. Image Process,
pp. 2769-2772. Oct. 8-11
49
[154] Rajaram, S., Gupta, M.D., Petrovic, N., Huang, T.S. Learning-based
nonparametric image super-resolution (2006) EURASIP J. Appl. Signal Process, 2006,
p. 229.
[155] Wang, S.Z., Lee, H.J. A cascade framework for a real-time statistical plate
recognition system (2007) IEEE Trans. Inf. Forensics Security, 2 (2), pp. 267-282. Jun
[156] Viola, P., Jones, M. Robust real-time face detection (2004) Int. J. Comput. Vis, 57
(2), pp. 137-154. May
50
APPENDIX
A.SourceCode :
import numpy as np
import cv2
import imutils
import sys
import pytesseract
import pandas as pd
import time
51
# perform edge detection
edged = cv2.Canny(gray, 170, 200)
cv2.imshow("Canny Edges", edged)
cv2.waitKey(0)
cv2.destroyAllWindows()
NumberPlateCnt = None
count = 0
# loop over contours
for c in cnts:
# approximate the contour
peri = cv2.arcLength(c, True)
approx = cv2.approxPolyDP(c, 0.02 * peri, True)
# if the approximated contour has four points, then assume that screen is found
if len(approx) == 4:
NumberPlateCnt = approx
Break
# mask the part other than the number plate
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)
52
# configuration for tesseract
config = ('-l eng --oem 1 --psm 3')
cv2.waitKey(0)
cv2.destroyAllWindows()
53