0% found this document useful (0 votes)
71 views89 pages

Null 1

Our project on read management

Uploaded by

playboyforu6666
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views89 pages

Null 1

Our project on read management

Uploaded by

playboyforu6666
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 89

A Major Project Report

On

VEHICLE NUMBER PLATE DETECTION AND


OWNER DETAILS USING PYTHON
Submitted for partial fulfilment of the requirements for the award of the
degree
of
BACHELOR OF TECHNOLOGY
IN
ELECTRONICS AND COMMUNICATION ENGINEERING
BY
Mr. D. Pavankalyan (20641A0442)
Mr. G. Nithin (20641A0451)
Mr. D. Vamshi (20641A0423)
Ms. M. Swathi (20641A0403)
Under the Guidance of
Dr. Pankaj Hivraj Rangaree
Associate professor

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING

VAAGDEVI COLLEGE OF ENGINEERING


(Autonomous, Affiliated to JNTUH, Accredited By NBA)
BOLLIKUNTA, WARANGAL - 506 005
2020-2024
DEPARTMENT OF ELECTRONICS AND COMMUNICATION
ENGINEERING

VAAGDEVI COLLEGE OF ENGINEERING


(Autonomous, Affiliated to JNTUH, NAAC ‘A’ Grade and NBA
Accredited)

BOLLIKUNTA, WARANGAL – 506 005


2023 – 2024

CERTIFICATE
This is to certify that the project work entitled “VEHICLE NUMBER
PLATE DETECTION AND OWNER DETAILS USING PYTHON” is a
Bonafide work carried out by Mr. D. Pavankalyan (20641A0442), Mr. G.
Nithin (20641A0451), Mr. D. Vamshi (20641A0423), Ms. M. Swathi
(20641A0403) in partial fulfilment of the requirements for the subject Major
project of degree of Bachelor of Technology in Electronics &
Communication Engineering from Vaagdevi College of Engineering
(Autonomous) during the academic year 2023-2024.

Dr. Pankaj Hivraj Rangaree Dr. M. Shashidhar


Associate professor Head of the Department

Project guide
DECLARATION
We declare that, the Project entitled “VEHICLE NUMBER PLATE
DETECTION AND OWNER DETAILS USING PYTHON” is an outcome
of our own efforts under the guidance of Dr. Pankaj Hivraj Rangaree,
Associate professor. The project is submitted to the Vaagdevi College of
Engineering. For the partial fulfilment of the requirements for the subject major
project of degree of Bachelor of Technology in Electronics &
Communication Engineering during the academic year of 2023-2024.

We also declare that this project report has not been previously submitted
to any other institute or university.

Mr. D. Pavankalyan (20641A0442)


Mr. G. Nithin (20641A0451)
Place: Warangal Mr. D. Vamshi (20641A0423)
Date: 01-05-2024 Ms. M. Swathi (20641A0403)
ACKNOWLEDGEMENT
The development of the project in Major project though it was an arduous task,
it has been made by the help of many people. We are pleased to express our
thanks to the people whose suggestions, comments, criticisms greatly
encouraged us in betterment of the project.

We would like to express our sincere gratitude and indebtedness to our project
guide Dr. Pankaj Hivraj Rangaree, Associate professor, for his valuable
suggestions and interest throughout the course of this project.

We would like to express my sincere thanks and profound gratitude to Dr. K.


Prakash, Principal of Vaagdevi College of Engineering, for his support,
guidance and encouragement in the course of our project.

We are also thankful to the Head of the Department Dr. M. Shashidhar,


Professor for providing excellent infrastructure and a nice atmosphere for
completing this project successfully.

We are highly thankful to the project coordinators for their valuable


suggestions, encouragement and motivations for completing this project
successfully.

We are thankful to all other faculty members for their encouragement.

We convey our heartfelt thanks to the lab staff for allowing us to use the required
equipment whenever needed.

Finally, we would like to take this opportunity to thank our family for their
support through the work. We sincerely acknowledge and thank all those who
gave directly or indirectly their support in completion of this work.

Mr. D. Pavankalyan (20641A0442)


Mr. G. Nithin (20641A0451)
Mr. D. Vamshi (20641A0423)
Ms. M. Swathi (20641A0403)
Page nos.

Table of Contents
Abstract .............................................................................................................. i

List of Figures ............................................................................................... ii-iii

List of Tables ................................................................................................... iv

List of Acronyms ............................................................................................... v

Chapter 1

INTRODUCTION 1
1.1 Motivation 2

1.2 Problem specification 3

1.3 objectives 3

Chapter 2

LITERATURE SURVEY 4-11


Chapter 3

SYSTEM ANALYSIS

3.1 Existing System 12


3.2 Proposed System 12
3.3 Advantages 13
3.4 Applications 13
Chapter 4

SYSTEM REQUIREMENTS

4.1 Software Required 14-22

4.2 Image Processing 22-34


4.3 Hardware Required 35-44

Chapter 5

SYSTEM DESIGN

5.1 System Architecture Diagram 45


5.2 Data flow diagram 46-47
5.3 Modules 47-49
Chapter 6

IMPLEMENTATION
6.1 Source Code 50-56

6.2 Software Environment 57-68


6.3 Testing 68-71

6.4 Test cases 71


Chapter 7

RESULT 72

Chapter 8
CONCLUSION& FUTURE SCOPE
8.1 Conclusion 73
8.2 Future scope 74
REFERENCE 75-78
ABSTRACT
Automatic Number Plate Recognition (ANPR) system is an automated mass
surveillance method that uses several Digital Image Processing (DIP) technique
and Optical Character Recognition (OCR) on images to read and identify
vehicle registration plates. ANPR has yielded multiple positive results in
practical applications such as: access control, traffic law enforcement, inventory
and property management, security systems surveillance, parking space
allocation, and road traffic surveillance. The automatic number plate recognition
system (ANPR) developed in this research work focused mainly on number
plate localization and licence plate extraction from an image for possible
application in different areas. It achieves this by using several OpenCV digital
image processing (DIP) technique developed with python to bring about image
segmentation from which some image segments were tested for characters, so
that the length of character found on each segment with similar properties
becomes the key towards localizing and cropping off the region with the actual
vehicle licence plate. Some properties of characters that was used to isolate the
possible licence plate are the fact that characters of the licence plate have
corresponding image height, width, aspect ratio etc. using these pixel properties
it was possible to filter off unwanted contour lines/curves that stands out as noise
while localizing the actual region of the image having the plate number. Once
the region was obtained OCR was used via a trained template for several
character styles to obtain the text format of the licence plate. The work
developed had a plate localization accuracy of 100% and 90% read accuracy.

i
LIST OF FIGURES Pg Nos

4.1 Input Car Image 23


4.2 Grayscale image after image enhancing 25
4.3 After applying Edge Detection method 27
4.4 Image after Contour Analysis 27
4.5 Number Plate Localization 28
4.6 Dilation 29
4.7 Erosion 30
4.8 Segmentation of characters 31
4.9 Character Recognition 32
4.10 Template Matching 33
4.11 Owner details 34
4.12 Node MCU Development Board/Kit v0.9(version) 35
4.13 Node MCU Development Board/Kit v1.0(version2) 36
4.14 Node MCU ESP32 Dev Kit v1.0 Pin diagram 38
4.15 ESP32 Camera 41
4.16 Mechanical Assignment 42
4.17 Pin Assignment 43
4.18 Schematic 44
5.1 System architecture 45
5.2 flow chart 46
5.3 Preprocessing 48
5.4 Number plate 49
6.1 Official site 62
6.2 Latest version of windows 63
6.3 Python release by specific number 63
6.4 different versions of python 64
6.5 Installation Process 65
6.6 Installation Process 65

ii
6.7 Python 3.7.4 is successfully Installed 66
6.8 Starting Window 66
6.9 Testing 67
6.10 IDLE 67
6.11 Process 68
7.1 final result 72

iii
LIST OF TABLES Pg Nos
4.1 Pin configuration 39
6.1 User Requirements 71

iv
LIST OF ACRONYMS
OCR – Optical Character Recognition
ANPR – Automatic Number Plate Recognition
DIP – Digital Image Processing
ALPR – Automatic Liscense Plate Recognition
CCTV – Closed Circuit Television
OpenCV – Open Source Computer Vision
CWI – Centrum Wiskunde & Informatica
ML – Machine Learning
cmd – Command
SRS – Software Requirements Specification

v
CHAPTER-1
INTRODUCTION
Optical Character Recognition, or OCR, is a technology that enables people 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. Imagine
there is a paper document - for example, magazine article, brochure, or PDF
contract a person sent to another person by email. Obviously, a scanner is not
enough to make this information available for editing, say in Microsoft Word. All
a scanner can do is create an image or a snapshot of the document that is nothing
more than a collection of black and white or colour dots, known as a raster image.
In order to extract and repurpose data from scanned documents, camera images or
image-only PDFs, it needs an OCR software that would single out letters on the
image, put them into words and then - words into sentences, thus enabling people
to access and edit the content of the original document. OCR is a field of research
in pattern recognition, artificial intelligence and computer vision. OCR engines
have been developed into many kinds of domain-specific OCR applications, such
as receipt OCR, invoice OCR, check OCR, legal billing document OCR. They can
also be used for Automatic number plate recognition. OpenCV (Open Source
Computer Vision) is a library of programming functions mainly aimed at real-time
computer vision and also a machine learning software library. OpenCV was built
to provide a common infrastructure for computer vision applications and to
accelerate the use of machine perception in the commercial products. Being a BSD-
licensed product, OpenCV makes it easy for businesses to utilize and modify the
code. In this project OpenCV includes a statistical machine learning library that
contains k nearest neighbor algorithm which is coded in Python (a widely used
dynamic programming language). Main Aim of this project is to develop a License
Plate Recognition software which recognises different types of characters in an
image and gives specific extracted output in text format. The objective of this
project is to extract characters from a License Plate with the use of computer vision
libraries and algorithms. A suitable algorithm needs to be constructed and trained

1
for different set of images. The program code has to be written in Python with the
inclusion of suitable OpenCV libraries. The program should be able to extract the
characters and print the output in text format for training purpose.

1.1 MOTIVATION
As a result of the growing number of vehicles on the road, with each having
different plate numbers and their use in crime perpetration, amongst others, it
became imperative for the development of an automated electronic system of
vehicle identification through the recognition of vehicle numberplate (Haines,
2009). This automated electronic system usually called Automatic number-plate
recognition (ANPR) is a technology that uses Optical Character Recognition (OCR)
on images to read vehicle registration plates to create vehicle location data, it uses
existing closed circuit television, road-rule enforcement cameras, or cameras
specifically designed for the task (Wikipedia contributors, 2020). ANPR have
different areas in which it can be applied or used. It is used by police for law
enforcement purposes; with this the police can automatically check for registered
vehicles or stolen vehicles (NPPC, 2016). Also, ANPR have been deployed as
electronic toll collection on pay-per-use roads, by the government as way of
revenue collection (Anuja1, Anusha, Dharshini, Muruga, & Radha, 2017). It has
also been applied in the area of gathering statistical data of movement of traffic
along highways. ANPR have been applied in some homes/offices to manage vehicle
access control in to its garage/premises. It has also been used to create database of
stored images captured by the ANPR camera and extraction of the text from the
image of the license plate for possible crime investigation (Hamed, 2016) (Ganesh
& Kailash, 2015). The ANPR technology has become so important through the
years since its invention and first application in the UK in 1979 and in recent time
has been greatly integrated into many aspects of human life.

2
1.2 PROBLEM SPECIFICATIONS
Automatic vehicle license plate detection and recognition is a key technique in most
of traffic related applications and is an active research topic in the image processing
domain. Different methods, techniques and algorithms have been developed for
license plate detection and recognitions. Due to the varying characteristics of the
license plate from country to country like numbering system, colors, language of
characters, style (font) and sizes of license plate, further research is still needed in
this area. In most of the middle East countries, they use the combination of Arabic
and English letters, plus their countries logo. Thus, it makes the localization of plate
number, the differentiation between Arabic and English letters and logo's object and
finally the recognition of those characters become more challenging research task.
The use of artificial neural network has proved itself beneficial for plate
recognition, but it has not been applied for the plate detection. Radial Basis
Function (RBF) neural network is used both for the detection and recognition of
Saudi Arabian license plate. The proposed approach has been tested on 200 front
images of national license plate of Saudi Arabia. A higher percentage of accuracy
has been obtained to show that the significant of this approach.

1.3 OBJECTIVE
With the popularization of automobile and the progress of computer vision
detection technology, intelligent license plate detection technology has gradually
become an important part of intelligent traffic management. License plate detection
is used to segment vehicle image and obtain license plate area for follow-up
recognition system to screen. It is widely used in intelligent traffic management,
vehicle video monitoring and other fields. In this paper, two license plate detection
methods are studied, one is based on Sobel edge detection and the other is based on
morphological gradient detection. Basing on OpenCV and PYTHON under
Windows system, two methods of license plate detection are implemented, and the
two algorithms are compared in detail from the aspects of license plate detection
accuracy. These methods have high efficiency and good interactivity, which
provide a reference for later license plate recognition.

3
CHAPTER-2
LITERATURE SURVEY
Title: Deep Learning System for Automatic License Plate Detection and
Recognition.

Authors: Zied Selmi, Mohamed Ben Halima, Adel M. Alimi.

Year: 2017

Methodology: The detection and recognition of a vehicle License Plate (LP) is a


key technique in most of the applications related to vehicle movement. Moreover,
it is a quite popular and active research topic in the field of image processing.
Different methods, techniques and algorithms have been developed to detect and
recognize LPs. Nevertheless, due to the LP characteristics that vary from one
country to another in terms of numbering system, colors, language of characters,
fonts and size. Further investigations are still needed in this field in order to make
the detection and recognition process very efficient. Although this domain has been
covered by a lot of researchers, various existing systems operate under well-defined
and controlled conditions.

Advantages:

1. High Accuracy
2. End-to-End Solution
3. Adaptability
4. Reduced manual Intervention

Disadvantages:

1. Data Privacy Concerns


2. Accuracy
3. Dependency on Data Quality
4. Vulnerability to Adversarial Attacks
5. Regulatory and Legal Challenges
6. Ethical Considerations

4
Title: License Plate Detection with Machine Learning Without Using Number
Recognition.

Authors: Kazuo Ohzeki, Max Geigis, Stefan Alexander Schneider.

Year: 2019

Methodology: In autonomous driving, detecting vehicles together with their parts,


such as a license plate is important. Many methods with using deep learning detect
the license plate based on number recognition. However, there is an idea that the
method using deep learning is difficult to use for autonomous driving because of
the complexity in realizing deterministic verification. Therefore, development of a
method that does not use deep learning (DL) has become important again. Although
the authors have made the world's best performance in 2018 for Caltech data with
using DL, this concept has now turned to another research without using DL. The
CT5L method is the latest type, that includes techniques of the continuity of vertical
and horizontal black-and-white pixel values inside the plate, unique Hough
transform, only vertical and horizontal lines are detected, the top five in the order
of the number of votes to ensure good performance. In this paper, a method to
determine the threshold value for binarizing input by machine learning is proposed,
and good results are obtained.

Advantages:

1. Privacy Preservations
2. Reduced Complexity
3. Faster Processing
4. Cost-Effectiveness

Disadvantages:

1. Limited Functionality
2. Reduced Accuracy
3. Limited Applications
4. Reduced Flexibility

5
Title: The Automated Parking Fee Calculation Using License Plate Recognition
System.

Author: Worawut Yim yam, Mahasak Ketcham

Year: 2017

Methodology: Design automated parking fee calculation with license plate


recognition in order to reduce manual license plate identification that is mostly
employed at parking area of other leading malls where the vehicle circulation is
high. The automated parking fee calculation using license plate recognition system
helps streamline the process of calculating parking fees based on the license plate
information of vehicles entering and exiting a parking facility. With this system,
cameras or sensors capture the license plate of each vehicle as it enters and exits the
parking area. The license plate recognition technology can accurately read and
record the license plate numbers.

Using the recorded license plate information, the system can determine the duration
of each vehicle's stay in the parking facility. By applying predefined parking rates
or rules, the system automatically calculates the parking fee based on the duration
of the stay. This automated process eliminates the need for manual ticketing or
payment collection, making the parking experience more convenient for both the
parking facility operators and the vehicle owners.

Advantage:

1. It decrease manual operation including license plate identification and fee


calculation
2. cut off the staff wage
3. save time for identifying plate and figuring out parking fee as well.

Disadvantage:

1. It requires the license plate images are clear, sharp.


2. no reflection and the background should be white or light color and no pattern.

6
Title: Automatic car number plate recognition.

Authors: Anumol Sasi, Swapnil Sharma, Alice N. Cheeran

Year: 2017

Methodology: A traffic surveillance system includes detection of vehicles which


involves the detection and identification of license plate numbers. This paper
proposes an intelligent approach of detecting vehicular number plates automatically
using three efficient algorithms namely Ant colony optimization (ACO) used in
plate localization for identifying the edges, a character segmentation and extraction
algorithm and a hierarchical combined classification method based on inductive
learning and SVM for individual character recognition. Initially the performance of
the Ant Colony Optimization algorithm is compared with the existing algorithms
for edge detection namely Canny, Prewitt, Roberts, Mexican Hat and Sobel
operators. The Ant Colony Optimization used in communication systems has
certain limitations when used in edge detection like random initial ant position in
the image and the heuristic information being highly dictated by transition
probabilities. In this paper, modifications like assigning a well-defined initial ant
position and making use of weights to calculate heuristic value which will provide
additional information about transition probabilities are used to overcome the
limitations.

Advantages:

1. Efficiency: It automates the process of identifying and recording license plate


numbers, saving time and effort compared to manual methods.
2. Accuracy: Using computer vision algorithms, automatic detection can
accurately identify license plate numbers, reducing the risk of human error.
3. Real-Time Monitoring: Automatic detection enables real-time monitoring of
vehicles entering and exiting a location, enhancing security and surveillance
capabilities.

7
Disadvantages:

1. Expensive
2. More Complexity
3. Privacy Concerns

Title: An Efficient FPGA Implementation of Optical Character Recognition for


License Plate Recognition.

Authors: Yuan Jing, Bahar Youssefi, Mitra Mirhassani, Roberto Muscedere


Year: 2017
Methodology: The "Efficient FPGA Implementation of Optical Character
Recognition for License Plate Recognition" project aims to create a really cool
system that can quickly and accurately recognize the characters on license plates
using special hardware called FPGAs.

By using FPGAs, which are like super-fast and customizable computer chips, the
project wants to make the process of recognizing license plate characters much
faster and more efficient. This can be super helpful in things like automated toll
collection, parking management, and catching bad guys.

The goal is to make the system work in real-time, meaning it can process license
plate images really quickly and figure out what the characters are on the spot. This
way, it can help make license plate recognition systems work even better and faster.

Advantages: A robust FPGA based OCR system has been designed and tested with
imperfect and noisy license plate images.

It was able to maintain a 98:2% accuracy in recognizing the characters despite the
image imperfections.

Disadvantages: It requires a proper system with selection of network size, and the
optimized and efficient setup of the neuron activation function.

8
Title: Number Plate Recognition in Noisy Image.
Authors: Y. Y. Nguwi, W. J. Lim
Year: 2015
Methodology: Number plate recognition in noisy image projects aim to develop
algorithms or systems that can accurately detect and recognize license plates from
images, even when those images are of poor quality or contain various types of
noise, such as blurriness, low resolution, or interference from other objects. These
projects typically involve techniques from computer vision, machine learning, and
signal processing to preprocess the images, extract features, and then classify or
recognize the license plate characters. The ultimate goal is to enable automated
systems for tasks like vehicle tracking, toll collection, or law enforcement.

The system is able to tolerate noise level up to 20% with recognition rate of 85%.

Advantages:
This system is able to tolerate noise level up to 20% with recognition rate of 85%.
It utilizes a combination of filters and morphological transformation for
segmenting the number plate.

Disadvantage:
It caters only to same font and size number plates.

9
Title: Automatic Vehicle Number Plate Recognition Using Structured Elements.
Authors: Riazul Islam, Kazi Fatima Sharif, Satyen Biswas
Year: 2015
Methodology: The "Automatic Vehicle Number Plate Recognition Using
Structured Elements" project focuses on developing a system that can automatically
detect and recognize vehicle license plates using structured elements within the
license plate itself. Structured elements refer to specific patterns or characteristics
within the license plate design, such as the arrangement of characters, spacing, or
the presence of specific symbols.

This project typically involves the use of computer vision techniques to detect
license plates in images or video streams, followed by algorithms to segment and
extract the structured elements of the license plate. Machine learning or pattern
recognition methods may then be employed to recognize the characters on the plate
accurately.

The goal of this project is to create a robust and efficient system for automatic
license plate recognition that can be used for various applications such as law
enforcement, parking management, or toll collection.

An efficient and first computing technique for identifying vehicle number plate.
Limited amount of computations are employed.

Advantage: Efficient and first computing technique for identifying vehicle number
plate. Computationally very inexpensive as compared with most of the conventional
methods.

Disadvantage: Limited area coverage.

10
Title: New Convolutional Architecture for Vietnamese Car Plate Recognition.

Authors: Thanh-Nga Nguyen ; Duc-Dung Nguyen

Year: 2018

Methodology: License plate recognition is a form of an intelligent transportation


system. Although, there have been many studies on plate detection, character
segmentation, and character recognition, many challenges have still remained.
Convolutional Neural Network (CNN) has proven to be a powerful classification
tool to achieve state-of-the-art results on various recognition tasks. In the problem
of number plate recognition, CNN based methods are being used to solve problems
such as plate detection, character segmentation, and character recognition. Quality
of identification depends on the quality of each task. Viet Nam does not have a
recognition system that combines the three tasks together. So, our key idea is to
combine detection, segmentation, and recognition of multi-character number plates
using CNN. Our purpose is to recognize the full sequence of the number plate
without pre-segmentation. This paper presents a CNN-based method for high
accuracy car license plate recognition. The presented methods are evaluated 1,000
plate images of US car plates and 1,000 plate images for Vietnamese car plate
recognition. The experimental results show that our network achieves better
performance than many standard plate detection and recognition algorithms. This
dataset and the investigation results could be used as a baseline for future research
in the field.

Advantages:

1. Improved Accuracy

Disadvantages:

1. Limited Generation
2. Data Dependency
3. More Complexity
4. Overfitting

11
CHAPTER-3
SYSTEM ANALYSIS
3.1 EXISTING SYSTEM:

Existing system monitors the traffic violations primarily through CCTV recordings,
where the traffic police have to look into the frame where the traffic violation is
happening, zoom into the license plate. But this requires lot of manpower and time
as the traffic violations frequently and the number of people using motorcycles is
increasing day-by-day. What if there is a system, which would automatically if so,
would automatically extract the vehicles’ license plate number. Recent research
have successfully done this work based on CNN, R-CNN, LBP, HOG, HaaR
features, etc. But these works are limited with respect to efficiency, accuracy or the
speed with which object detection and classification is done.

3.2 PROPOSED SYSTEM:

This proposed system has the capability of detecting and recognizing vehicle
number plates. To detect each character of a number plate, this system trains all
alphabetic letters from the plate using machine learning. Number plate characters
for the majority countries across the world are from A to Z and 0 to 9, so that it can
easily be detected, whereas Bangla number plate detection and recognition is very
challenging, due to the complex alphanumeric characters.

The basic steps of the proposed methodology are: (a) pre-processing; (b)
localization of the number plate region; (c) super resolution techniques to get clear
images; (d) segmentation of characters; (e) feature extraction; and (f) recognition
of characters. After detecting the number plate of the vehicle by using the detected
number we can also extract owner details of the vehicle.

12
3.3 ADVANTAGES:
1. It is easy to maintain.
2. It is user-friendly.
3. The system will automatically detect and recognize the license plate.
4. It can detect vehicle license plates from an image and videos.
5. It can also detect in real.

3.4 APPLICATIONS:
1) Parking:
The plate number is used to automatically enter pre-paid members and calculate
parking fee for non-members (by comparing the exit and entry times).

2) Access-control:
A gate automatically opens for authorized members in a secured area, thus replacing
or assisting the security guard.

The events are logged on a database and could be used to search the history of
events.

3) Tolling:
The car number is used to calculate the travel fee in a toll road, or used to double-
check the ticket.
4) Border Control:
This installation covers the borders of the entire Country. Each vehicle is registered
into a central database and linked to additional information such as the passport
data. This can be used to track all border crossings.

13
CHAPTER-4
SYSTEM REQUIREMENTS
4.1 SOFTWARE REQUIRED:
• Operating System: Windows

• Coding Language: Python 3.7

What is Python:
Python is currently the most widely used multi-purpose, high-level programming
language. Python allows programming in Object-Oriented and Procedural
paradigms. Python programs generally smaller than other programming languages
like Java. Programmers have to type relatively less and indentation requirement of
the language, makes them readable all the time.

Python language is being used by almost all tech-giant companies like – Google,
Amazon, Facebook, Instagram, Dropbox, Uber… etc.

The biggest strength of Python is huge collection of standard library which can be
used for the following:

• Machine learning
• GUI Applications (like Kivy, Tkinter, PyQt etc. )
• Web frameworks like Django (used by YouTube, Instagram, Dropbox)
• Image processing (like OpenCV, Pillow)
• Web scraping (like Scrapy, Beautiful Soup, Selenium)
• Test frameworks
• Multimedia

14
Advantages of Python:

1.Extensive Libraries:

Python downloads with an extensive library and it contain code for various
purposes like regular expressions, documentation-generation, unit-testing, web
browsers, threading, databases, CGI, email, image manipulation, and more. So, we
don’t have to write the complete code for that manually.

2. Extensible:

As we have seen earlier, Python can be extended to other languages. You can write
some of your code in languages like C++ or C. This comes in handy, especially in
projects.

3. Embeddable:

Complimentary to extensibility, Python is embeddable as well. You can put your


Python code in your source code of a different language, like C++. This lets us
add scripting capabilities to our code in the other language.

4. Improved Productivity:

The language’s simplicity and extensive libraries render programmers more


productive than languages like Java and C++ do. Also, the fact that you need to
write less and get more things done.

5. IOT Opportunities:

Since Python forms the basis of new platforms like Raspberry Pi, it finds the future
bright for the Internet Of Things. This is a way to connect the language with the
real world.

6. Simple and Easy:

When working with Java, you may have to create a class to print ‘Hello World’.
But in Python, just a print statement will do. It is also quite easy to
learn, understand, and code. This is why when people pick up Python, they have a
hard time adjusting to other more verbose languages like Java. As programming

15
languages go, Python is relatively uncluttered, and the developers have deliberately
kept it that way.

A rough estimate of the complexity of a language can be gleaned from the number
of keywords or reserved words in the language. These are words that are reserved
for special meaning by the compiler or interpreter because they designate specific
built-in functionality of the language.

Python 3 has 33 keywords, and Python 2 has 31. By contrast, C++ has 62, Java has
53, and Visual Basic has more than 120, though these latter examples probably vary
somewhat by implementation or dialect.

Python code has a simple and clean structure that is easy to learn and easy to read.
In fact, as you will see, the language definition enforces code structure that is easy
to read.

But It’s Not That Simple For all its syntactical simplicity, Python supports most
constructs that would be expected in a very high-level language, including complex
dynamic data types, structured and functional programming, and object-oriented
programming.

Additionally, a very extensive library of classes and functions is available that


provides capability well beyond what is built into the language, such as database
manipulation or GUI programming.

Python accomplishes what many programming languages don’t: the language itself
is simply designed, but it is very versatile in terms of what you can accomplish with
it.

7. Readable:

Because it is not such a verbose language, reading Python is much like reading
English. This is the reason why it is so easy to learn, understand, and code. It also

16
does not need curly braces to define blocks, and indentation is mandatory. This
further aids the readability of the code.

8. Object-Oriented:

This language supports both the procedural and object-oriented programming


paradigms. While functions help us with code reusability, classes and objects let us
model the real world. A class allows the encapsulation of data and functions into
one.

9. Free and Open-Source:

Like we said earlier, Python is freely available. But not only can you download
Python for free, but you can also download its source code, make changes to it, and
even distribute it. It downloads with an extensive collection of libraries to help you
with your tasks.

10. Portable:

When you code your project in a language like C++, you may need to make some
changes to it if you want to run it on another platform. But it isn’t the same with
Python. Here, you need to code only once, and you can run it anywhere. This is
called Write Once Run Anywhere (WORA). However, you need to be careful
enough not to include any system-dependent features.

11. Interpreted:

Lastly, we will say that it is an interpreted language. Since statements are executed
one by one, debugging is easier than in compiled languages.

Advantages of Python over other Languages:


1. Less Coding:

Almost all of the tasks done in Python requires less coding when the same task is
done in other languages. Python also has an awesome standard library support, so
you don’t have to search for any third-party libraries to get your job done. This is
the reason that many people suggest learning Python to beginners.

17
2. Affordable:

Python is free therefore individuals, small companies or big organizations can


leverage the free available resources to build applications. Python is popular and
widely used so it gives you better community support.

The 2019 Github annual survey showed us that Python has overtaken Java in the
most popular programming language category.

3. Python is for Everyone:

Python code can run on any machine whether it is Linux, Mac or Windows.
Programmers need to learn different languages for different jobs but with Python,
you can professionally build web apps, perform data analysis and machine learning,
automate things, do web scraping and also build games and powerful visualizations.
It is an all-rounder programming language.
Conclusion:

This section gave an overview of the Python programming language, including:

• A brief history of the development of Python


• Some reasons why you might select Python as your language of choice

Python is a great option, whether you are a beginning programmer looking to learn
the basics, an experienced programmer designing a large application, or anywhere
in between. The basics of Python are easily grasped, and yet its capabilities are vast.
Proceed to the next section to learn how to acquire and install Python on your
computer.

Python is an open source programming language that was made to be easy-to-read


and powerful. A Dutch programmer named Guido van Rossum made Python in
1991. He named it after the television show Monty Python's Flying Circus. Many
Python examples and tutorials include jokes from the show.

Python is an interpreted language. Interpreted languages do not need to


be compiled to run. A program called an interpreter runs Python code on almost

18
any kind of computer. This means that a programmer can change the code and
quickly see the results. This also means Python is slower than a compiled language
like C, because it is not running machine code directly.

Python is a good programming language for beginners. It is a high-level language,


which means a programmer can focus on what to do instead of how to do it. Writing
programs in Python takes less time than in some other languages.

Python drew inspiration from other programming languages like


C, C++, Java, Perl, and Lisp.

Python has a very easy-to-read syntax. Some of Python's syntax comes from C,
because that is the language that Python was written in. But Python uses whitespace
to delimit code: spaces or tabs are used to organize code into groups. This is
different from C. In C, there is a semicolon at the end of each line and curly braces
({}) are used to group code. Using whitespace to delimit code makes Python a very
easy-to-read language.

Machine Learning:
Machine learning is often categorized as a subfield of artificial intelligence, but I
find that categorization can often be misleading at first brush. The study of machine
learning certainly arose from research in this context, but in the data science
application of machine learning methods, it's more helpful to think of machine
learning as a means of building models of data.

Fundamentally, machine learning involves building mathematical models to help


understand data. "Learning" enters the fray when we give these models tunable
parameters that can be adapted to observed data; in this way the program can be
considered to be "learning" from the data. Once these models have been fit to
previously seen data, they can be used to predict and understand aspects of newly
observed data. I'll leave to the reader the more philosophical digression regarding
the extent to which this type of mathematical, model-based "learning" is similar to
the "learning" exhibited by the human brain. Understanding the problem setting in

19
machine learning is essential to using these tools effectively, and so we will start
with some broad categorizations of the types of approaches.

Categories of Machine Learning:

At the most fundamental level, machine learning can be categorized into two main
types: supervised learning and unsupervised learning.

Supervised learning involves somehow modeling the relationship between


measured features of data and some label associated with the data; once this model
is determined, it can be used to apply labels to new, unknown data. This is further
subdivided into classification tasks and regression tasks: in classification, the labels
are discrete categories, while in regression, the labels are continuous quantities. We
will see examples of both types of supervised learning in the following section.

Unsupervised learning involves modeling the features of a dataset without reference


to any label, and is often described as letting the dataset speak for itself. These
models include tasks such as clustering and dimensionality reduction. Clustering
algorithms identify distinct groups of data, while dimensionality reduction
algorithms search for more succinct representations of the data. We will see
examples of both types of unsupervised learning in the following section.

Need for Machine Learning:


Human beings, at this moment, are the most intelligent and advanced species on
earth because they can think, evaluate and solve complex problems. On the other
side, AI is still in its initial stage and haven’t surpassed human intelligence in many
aspects. Then the question is that what is the need to make machine learn? The most
suitable reason for doing this is, “to make decisions, based on data, with efficiency
and scale”.

Lately, organizations are investing heavily in newer technologies like Artificial


Intelligence, Machine Learning and Deep Learning to get the key information from
data to perform several real-world tasks and solve problems. We can call it data-

20
driven decisions taken by machines, particularly to automate the process. These
data-driven decisions can be used, instead of using programing logic, in the
problems that cannot be programmed inherently. The fact is that we can’t do
without human intelligence, but other aspect is that we all need to solve real-world
problems with efficiency at a huge scale. That is why the need for machine learning
arises.

Challenges in Machines Learning:


While Machine Learning is rapidly evolving, making significant strides with
cybersecurity and autonomous cars, this segment of AI as whole still has a long way
to go. The reason behind is that ML has not been able to overcome number of
challenges.

The challenges that ML is facing currently are:

Quality of data − Having good-quality data for ML algorithms is one of the biggest
challenges. Use of low-quality data leads to the problems related to data
preprocessing and feature extraction.

Time-Consuming task − Another challenge faced by ML models is the


consumption of time especially for data acquisition, feature extraction and retrieval.

Lack of specialist persons − As ML technology is still in its infancy stage,


availability of expert resources is a tough job.

No clear objective for formulating business problems − Having no clear


objective and well-defined goal for business problems is another key challenge for
ML because this technology is not that mature yet.

Issue of overfitting & underfitting − If the model is overfitting or underfitting, it


cannot be represented well for the problem.

Curse of dimensionality − Another challenge ML model faces is too many features


of data points. This can be a real hindrance.

Difficulty in deployment − Complexity of the ML model makes it quite difficult


to be deployed in real life.

21
Applications of Machines Learning:
Machine Learning is the most rapidly growing technology and according to
researchers we are in the golden year of AI and ML. It is used to solve many real-
world complex problems which cannot be solved with traditional approach.
Following are some real-world applications of ML:

• Emotion analysis

• Sentiment analysis

• Error detection and prevention

• Weather forecasting and prediction

• Stock market analysis and forecasting

• Speech synthesis

• Speech recognition

• Customer segmentation

• Object recognition

• Fraud detection

• Fraud prevention

• Recommendation of products to customer in online shopping

4.2 IMAGE PROCESSING:


Image Processing is a technique to enhance raw images received from
cameras/sensors placed on space probes, aircrafts and satellites or pictures taken in
normal day-to-day life for various applications. An Image is rectangular graphical
object. Image processing involves issues related to image representation,
compression techniques and various complex operations, which can be carried out
on the image data. The operations that come under image processing are image
enhancement operations such as sharpening, blurring, brightening, edge
enhancement etc. Image processing is any form of signal processing for which the
input is an image, such as photographs or frames of video; the output of image
processing can be either an image or a set of characteristics or parameters related to

22
the image. Most image-processing techniques involve treating the image as a two-
dimensional signal and applying standard signal processing techniques to it. Image
processing usually refers to digital image processing, but optical and analog image
processing are also possible.

IMAGE PRE-PROCESSING:

Image is pre-processed through different algorithms and location of number plate


is extracted. Major stages are:

1. RGB to Gray scale conversion


2. Image Enhancement
3. Edge Detection
4. Contour Analysis
5. Number Plate Localization
6. Dilation of BGM (Binary Gradient Masking)
7. Erosion
8. Character Segmentation
9. Character Recognition
10. Template Matching
11. Post Processing
Input raw Image:
Input the image that is taken from the car.

Fig 4.1: Input Car Image

23
RGB to GRAY Conversion:
Humans perceive color through wavelength-sensitive sensory cells called cones.
There are three different varieties of cones, each has a different sensitivity to
electromagnetic radiation (light) of different wavelength. One cone is mainly
sensitive to green light, one to red light, and one to blue light. By emitting a
restricted combination of these three colors (red, green and blue), and hence
stimulate the three types of cones at will, we are able to generate almost any
detectable color. This is the reason behind why color images are often stored as
three separate image matrices; one storing the amount of red (R) in each pixel, one
the amount of green (G) and one the amount of blue (B). We call such color images
as stored in an RGB format. In grayscale images, however, we do not differentiate
how much we emit of different colors, we emit the same amount in every channel.
We will be able to differentiate the total amount of emitted light for each pixel; little
light gives dark pixels and much light is perceived as bright pixels. When
converting an RGB image to grayscale, we have to consider the RGB values for
each pixel and make as output a single value reflecting the brightness of that pixel.
One of the approaches is to take the average of the contribution from each channel:
(R+B+C)/3. However, since the perceived brightness is often dominated by the
green component, a different, more "human-oriented", method is to consider a
weighted average, e.g.: 0.3R + 0.59G + 0.11B.

Image Enhancement:
Image enhancement is the process of adjusting digital images so that the results are
more suitable for display or further analysis. For example, we can eliminate noise,
which will make it more easier to identify the key characteristics. In poor contrast
images, the adjacent 26 characters merge during binarization. We have to reduce
the spread of the characters before applying a threshold to the word image. Hence,
we introduce “POWER- LAW TRANSFORMATION” which increases the
contrast of the characters and helps in better segmentation. The basic form of
power-law transformation is s = cr γ, where r and s are the input and output
intensities, respectively; c and γ are positive constants. A variety of devices used
for image capture, printing, and display respond according to a power-law. By

24
convention, the exponent in the power-law equation is referred to as gamma. Hence,
the process used to correct these power-law response phenomena is called gamma
correction. Gamma correction is important, if displaying an image accurately on a
computer screen is of concern. In our experimentation, γ is varied in the range of 1
to 5. If c is not equal to ’1’, then the dynamic range of the pixel values will be
significantly affected by scaling. Thus, to avoid another stage of rescaling after
power-law transformation, we fix the value of c = 1. With γ = 1, if the power-law
transformed image is passed through binarization, there will be no change in the
result compared to simple binarization. When γ > 1, there will be a change in the
histogram plot, since there is an increase of samples in the bins towards the gray
value of zero. Gamma correction is important if displaying an image accurately on
computer screen is of concern.

Fig:4.2: Grayscale image after image enhancing

Edge Detection:
Edge detection is the name for a set of mathematical methods which aim at
identifying points in a digital image at which the image brightness changes sharply
or, more technically, has discontinuities or noise. The points at which image
brightness alters sharply are typically organized into a set of curved line segments
termed edges.

25
Edge detection techniques:
Different colors has different brightness values of particular color. Green image
has more bright than red and blue image or blue image is blurred image and red
image is the high noise image. Following are list of various edge-detection methods:

• Sobel Edge Detection Technique

• Perwitt Edge Detection

• Roberts Edge Detection Technique

• Zero cross Threshold Edge Detection Technique

• Canny Edge Detection Technique In our project we use “CANNY EDGE


DETECTION TECHNIQUE”

Canny Edge Detection:


The Canny Edge Detector is one of the most commonly used image processing tools
detecting edges in a very robust manner. It is a multi-step process, which can be
implemented on the GPU as a sequence of filters. Canny edge detection technique
is based on three basic objectives. The edges located must be as close as possible to
the true edges. That is, the distance between a point marked as an edge by the
detector and the center of the true edge should be minimum.

Single edge point response: The detector should return only one point for each true
edge point. That is, the number of local maxima around the true edge should be
minimum. This means that the detector should not identify multiple edge pixels
where only a single edge point exist. The essence of Canny’s work was in eressing
the preceding three criteria mathematically and then attempting to find optimal
solution to these formulations, in general, it is difficult to find a close form solution
that satisfies all the preceding objectives. However, using numerical optimization
with 1-D step edges corrupted by additive while Gaussian noise led to the
conclusion that a good approximation to the optimal step edge. Because the
direction of the normal is unknown beforehand, this would require applying the 1-
D edge detector in all possible directions. This task can be approximated by first
smoothing the image with circular 2-D Gaussian function, computing the gradient

26
of the result, and then using the gradient magnitude and direction to estimate edge
strength and direction at every point. Let f(x, y) denote the input image and G(x, y)
denote.

Fig 4.3: After applying edge detection method

Contour Analysis:
Contour Detection:
Once the edges are detected, the next step is to find contours. Contours are the
continuous curves that form the boundaries of objects in an image. The OpenCV
library in Python provides functions to detect contours.

Contour analysis is an effective technique because it allows us to extract the shape


and structure of objects within an image. By applying contour analysis in vehicle
number plate detection, we can accurately locate and extract the number plate
region for further processing.

Fig 4.4: Image after Contour Analysis

27
Contour Filtering:
After detecting contours, filtering techniques are applied to select the contours that
are most likely to represent the number plate. This can be based on factors like
contour area, aspect ratio, or hierarchy.

Number Plate Localization:


When it comes to number plate localization in vehicle number plate detection, the
goal is to precisely locate the position of the number plate on a vehicle. This is done
using computer vision techniques and algorithms.

The process typically involves analyzing the image or video frame of a vehicle to
identify potential regions where the number plate might be located. Various features
such as color, shape, and texture are used to distinguish the number plate from the
rest of the vehicle.

Once potential regions are identified, further processing is done to refine and
accurately localize the number plate.

After the number plate is localized, it can be extracted and passed on to the next
stage of the system for character recognition or other tasks. This information can be
used for various applications like automated toll collection, parking management,
or law enforcement.

Fig 4.5: Number Plate Localization

Dilation of BGM:
In the context of number plate localization, BGM stands for Background Modeling.
It's a technique used to model and differentiate the background from the foreground
in an image or video frame.

28
Dilation, on the other hand, is a morphological operation that expands or thickens
the boundaries of objects in an image. It's commonly used to enhance or modify the
shape of objects.

In the project you mentioned, the dilation of BGM technique is likely used to refine
the localized number plate region. After the initial localization using background
modeling, the boundaries of the number plate region can be further expanded or
dilated to ensure that the entire number plate is included.

By applying dilation, any gaps or inconsistencies in the initial localization can be


filled in, resulting in a more accurate and complete representation of the number
plate. This helps in improving the subsequent steps of character recognition or other
tasks related to number plate analysis.

Fig 4.6: Dilation

Erosion:
In the context of number plate localization, erosion is a morphological operation
that shrinks or erodes the boundaries of objects in an image.

In the project you mentioned, the erosion technique is likely used as a


complementary step to the dilation technique we discussed earlier. After the number
plate region has been expanded or dilated, erosion can be applied to refine the
boundaries and remove any noise or unwanted pixels.

By applying erosion, the localized number plate region can be made more compact
and precise. It helps in removing any extra pixels that might have been included

29
during the dilation process, resulting in a cleaner and more accurate representation
of the number plate.

Overall, erosion is an important step in the number plate localization process as it


helps in fine-tuning the boundaries of the detected region. It works hand in hand
with dilation to ensure that the localized number plate is as accurate and well-
defined as possible.

Fig 4.7: Erosion

Character Segmentation:
Character segmentation is a technique used in number plate recognition systems to
separate individual characters from the detected number plate region. It's an
essential step in the process of extracting and recognizing the characters on the
number plate.

In this project, after the number plate has been localized using techniques like
background modeling, dilation, and erosion, character segmentation comes into
play. The goal is to accurately identify and isolate each character on the number
plate.

30
The process of character segmentation involves analyzing the localized number
plate region and determining the boundaries of each character.

Once the characters are segmented, they can be passed on to the next stage of the
system for character recognition. This involves using pattern recognition algorithms
or machine learning models to identify and interpret the individual characters.

By segmenting the characters, the system can effectively process and recognize the
alphanumeric information on the number plate, enabling applications like
automated toll collection, parking management, or law enforcement.

Character segmentation is a crucial step in number plate recognition systems, as it


allows for accurate and reliable character recognition. It helps in extracting the
necessary information from the number plate and enables further analysis and
processing.

Fig 4.8: Segmentation of characters

Character Recognition:
Character recognition, also known as Optical Character Recognition (OCR), is a
technique used to identify and interpret the individual characters on a number plate.
It plays a crucial role in automated systems that require extracting alphanumeric
information from number plates.

In this project, after the characters have been segmented from the localized number
plate region, character recognition techniques are applied to recognize and interpret
each character.

There are various approaches to character recognition, including traditional


methods and machine learning-based approaches. Traditional methods involve

31
extracting features from the segmented characters and comparing them to
predefined templates or using pattern matching algorithms.

On the other hand, machine learning-based approaches utilize algorithms and


models to learn from a large dataset of labeled characters. These models are trained
to recognize patterns and features in the characters, enabling accurate recognition.

Once the characters have been recognized, the system can use the identified
alphanumeric information for further processing or analysis. This can include tasks
such as vehicle identification, access control, or law enforcement applications.

Character recognition is a critical component of number plate recognition systems,


as it allows for the automated extraction of information from number plates. It
enables efficient and accurate processing of the alphanumeric data, contributing to
the overall effectiveness of the system.

Fig 4.9: Character Recognition

Template Matching:
Recognition of a fixed-sized character is done appropriately by Template matching.
Other applications are the detection of objects generally in face detection and
medical image processing. There are two categories of template matching: Feature-
based matching and Template-based matching. Generally, a template-based
approach is useful whereas the feature-based approach is useful only when the
image has prominent features. In Prathamesh Kulkarni's paper, to achieve 85% of
the character recognition rate statistical feature extraction method is used. In the

32
paper on Automatic License-Plate Location and Recognition Based on Feature
Salience, several features and extracted and salient is computed based on training
characters. To adjust all characters with uniform size a linear normalization
algorithm is used. In a test amongst 1176 images, a recognition rate of 95.7% was
observed. An SVM based approach deployed for feature extraction of Chinese,
Kana, and English, Numeric characters, and achieved a success rate of 99.5%,
98.6%, and 97.8% for numerals, Kana, and address recognition respectively. A
template-based approach is proposed in the paper by Ch. Jaya Lakshmi. They used
a low-resolution template matching method to figure with a lower resolution image
like 4 X 8. The authors used similarity function to measure similarity between
patterns.

Fig 4.10: Template Matching

Post-Processing:
After character recognition, the next step would typically involve post-processing
and utilizing the recognized characters for specific purposes.

Once the characters have been recognized, post-processing techniques can be


applied to refine the results and improve accuracy. This may involve tasks such as
error correction, noise reduction, or context-based analysis to ensure the correct
interpretation of the characters.

Once the characters have been properly processed, the recognized alphanumeric
information can be used for various applications depending on the project's

33
requirements. For example, it can be used for automated toll collection, parking
management, traffic monitoring, or law enforcement purposes.

The recognized characters can be further analyzed or stored in a database for future
reference. They can also be utilized in real-time systems to trigger certain actions
or decisions based on the extracted information.

Overall, the next step after character recognition involves post-processing the
recognized characters and utilizing the extracted alphanumeric information for the
specific purposes and applications of the project.

Displaying Owner Details:


After successful detection of the number plate, the next and final step is to display
the owner's details. When the registration number is obtained by the system, it finds
details of the owner associated with that specific registered vehicle number. The
system maps the vehicle registration number with the database and produces output
in the form Registration name, License number, Registration date, Registration
authority, Vehicle class, Fuel type, Engine number, Fitness upto, etc.

Fig 4.11: Owner details

34
4.3 HARDWARE REQUIRED:
Node MCU:
Node MCU is an open source LUA based firmware developed for ESP8266 wi-fi
chip. By exploring functionality with ESP8266 chip, Node MCU firmware comes
with ESP8266 Development board/kit i.e. Node MCU Development board.

Fig 4.12: Node MCU Development Board/Kit v0.9(version1)

Since Node MCU is open source platform, their hardware design is open for
edit/modify/build.

Node MCU Dev Kit/board consist of ESP8266 wi-fi enabled chip. The ESP8266 is
a low-cost Wi-Fi chip developed by Espressif Systems with TCP/IP protocol.

There is Version2 (V2) available for Node MCU Dev Kit i.e. Node MCU
Development Board v1.0 (Version2), which usually comes in black colored PCB.

35
Fig 4.13: Node MCU Develop Board/Kit v1.0(version2)

Node MCU Dev Kit has Arduino like Analog (i.e. A0) and Digital (D0-D8) pins
on its board.
It supports serial communication protocols i.e. UART, SPI, I2C etc.
Using such serial protocols we can connect it with serial devices like I2C enabled
LCD display, Magnetometer HMC5883, MPU-6050 Gyro meter + Accelerometer,
RTC chips, GPS modules, touch screen displays, SD cards etc.

How to start with Node MCU?

Node MCU Development board is featured with wi-fi capability, analog pin,
digital pins and serial communication protocols.

To get start with using Node MCU for IoT applications first we need to know about
how to write/download Node MCU firmware in Node MCU Development Boards.
And before that where this Node MCU firmware will get as per our requirement.

There is online Node MCU custom builds available using which we can easily get
our custom Node MCU firmware as per our requirement.

How to write codes for Node MCU?


After setting up ESP8266 with Node-MCU firmware, let’s see the IDE (Integrated
Development Environment) required for development of Node MCU.

36
Node MCU with ESPlorer IDE
Lua scripts are generally used to code the Node MCU. Lua is an open source,
lightweight, embeddable scripting language built on top of C programming
language.

Node MCU with Arduino IDE


Here is another way of developing Node MCU with a well-known IDE i.e. Arduino
IDE. We can also develop applications on Node MCU using Arduino development
environment. This makes easy for Arduino developers than learning new language
and IDE for Node MCU.

Difference in using ESPlorer and Arduino IDE


Well, there is a programming language difference we can say while developing
application for Node MCU using ESPlorer IDE and Arduino IDE.

We need to code in C\C++ programming language if we are using Arduino IDE for
developing Node MCU applications and Lua language if we are using ESPlorer
IDE.

Basically, Node MCU is Lua Interpreter, so it can understand Lua script easily.
When we write Lua scripts for Node MCU and send/upload it to Node MCU, then
they will get executes sequentially. It will not build binary firmware file of code for
Node MCU to write. It will send Lua script as it is to Node MCU to get execute.

In Arduino IDE when we write and compile code, ESP8266 toolchain in


background creates binary firmware file of code we wrote. And when we upload it
to Node MCU then it will flash all Node MCU firmware with newly generated
binary firmware code. In fact, it writes the complete firmware.

That’s the reason why Node MCU not accept further Lua scripts/code after it is
getting flashed by Arduino IDE. After getting flashed by Arduino sketch/code it
will be no more Lua interpreter and we got error if we try to upload Lua scripts. To
again start with Lua script, we need to flash it with Node MCU firmware.

37
Since Arduino IDE compile and upload/writes complete firmware, it takes more
time than ESPlorer IDE.

Fig 4.14: Node MCU ESP32 Dev Kit v1.0 Pin Diagram

Image Source: Google Image Search (image is used for quick reference and non-
profit purpose only)

While writing GPIO code on Node MCU, you can’t address them with actual GPIO
Pin Numbers. There are different I/O Index numbers assigned to each GPIO Pin
which is used for GPIO Pin addressing. Refer following table to check I/O Index of
Node MCU GPIO Pins:

38
S. No GPIO Pin I/O Index
Number

1 GPIO0 3

2 GPIO1 10

3 GPIO2 4

4 GPIO3 9

5 GPIO4 2

6 GPIO5 1

7 GPIO6 N/A

8 GPIO7 N/A

9 GPIO8 N/A

10 GPIO9 11

11 GPIO10 12

12 GPIO11 N/A

13 GPIO12 6

14 GPIO13 7

15 GPIO14 5

16 GPIO15 8

17 GPIO16 0

Table 4.1: Pin Configuration

39
The objective of this post is to explain how to use the ESP8266 library defined
constants that have the correct mapping between Node MCU and ESP8266 pins.

Node MCU is a very easy to use ESP8266 board that can be bought at eBay for less
that 4 euros. It’s also very practical since it already has an USB header, so we can
program the microcontroller without any additional hardware.

Besides that, the pins are easily accessible, allowing us to take full advantage of the
capabilities of the ESP8266, as opposed to other simpler boards, such as the ESP-
01, which only expose some of the GPIOs of the microcontroller.

Nevertheless, as indicated in some previous tutorials, the numbers of the pins in the
board don’t map to the numbers of the pins on the ESP8266. So, for example, pin
D1 of the board doesn’t map to GPIO1 of the ESP8266 (it actually maps to GPIO5).

Naturally, if this is not taken in consideration, it will lead to a difficult debugging


process, since we will be assuming that the board is not working correctly.

So, the correct pin mapping is the following (Node MCU on the left and ESP8266
on the right):

D0 = GPIO16;
D1 = GPIO5;
D2 = GPIO4;
D3 = GPIO0;
D4 = GPIO2;
D5 = GPIO14;
D6 = GPIO12;
D7 = GPIO13;
D8 = GPIO15;
D9 = GPIO3;
D10 = GPIO1;
LED_BUILTIN = GPIO16 (auxiliary constant for the board LED, not a board pin);

40
Fortunately, this mapping is defined as constant on ESP8266 the libraries, so we
don’t need to constantly check it. Thus, we can, for example, call a digital Write on
pin D0, which will be translated to the real GPIO pin 16.

You can check the full mappings that can be used for the Node MCU here. Note
that there are also mappings for other ESP8266 boards, which you can check here.

ESP32-CAM WiFi+Bluetooth+Camera Module:


The ESP32-CAM is a development board with an ESP32-S chip, an OV2640
camera, microSD card slot and several GPIOs to connect peripherals. It allows you
to set up a video streaming web server, build a surveillance camera, take photos,
face recognition and detection, and much more.

Fig 4.15: ESP32 Camera

41
SKU: MDU1112 Brief Data:

▪ Product Name: ESP32-CAM.


▪ WiFi+Bluetooth module: ESP-32S.

▪ Camera Module: OV2640 2MP.

▪ Flash Light: LED Built-in on Board.

▪ Operating Voltage: 3.3/5 Vdc.

▪ Onboard TF card slot, supports up to 4G TF card for data storage .

▪ RAM: Internal 512KB + External 4MB PSRAM.

▪ Power consumption:
▪ Flash off: 180mA@5V.
▪ Flash on and brightness max: 310mA@5V.
▪ Deep-Sleep: as low as 6mA@5V.
▪ Modern-Sleep: as low as 20mA@5V.
▪ Light-Sleep: as low as 6.7mA@5V
▪ Dimensions: 40.5mm x 27mm x 4.5mm

Fig 4.16: Mechanical Dimension

42
Pin assignment:

Fig 4.17: Pin Assignment

43
Schematic:

Fig 4.18: Schematic

44
CHAPTER-5
SYSTEM DESIGN
5.1 SYSTEM ARCHITECTURE DIAGRAM:

IDE

Python libraries Vehicle Number


Plate Detection

DETECT
NUMBER FROM
IMAGE

Result

Fig 5.1: system architecture

45
5.2 DATA-FLOW DIAGRAM:

Input Image from camera

Image acquisition

Image Segmentation

Number Plate Localization

Character Segmentation
Fig 5.2: flow chart

Character Recognition

Displaying Owner Details

Fig 5.2: Flow Chart

46
Approach: To solve the defined character recognition process the python coded
algorithm with OpenCV libraries is used.
The processing of code is divided into the next categories:
• Image acquisition
• Pre-processing
• Feature extraction
• Detection/segmentation
• High-level processing
• Decision making
• OCR
Licenseplaterecognitionisatechnologythatusesopticalcharacterrecognitiononimage
s to read vehicle registration plates. It can use existing closed-circuit television,
road-rule enforcement cameras, or cameras specifically designed for the task. It is
used by police forces around the world for law enforcement purposes, including to
check if a vehicle is registered or licensed. It is also used for electronic toll
collection on pay-per-use roads and as a method of cataloging the movements of
traffic for example by highways agencies. OpenCV OpenCV (Open Source
Computer Vision Library) is an open source computer vision and machine learning
software library. OpenCV was built to provide a common infrastructure for
computer vision applications. Being a BSD-licensed product, OpenCV makes it
easy for anyone to utilize and modify the code. k-nearest neighbours algorithm (k-
NN) OpenCV includes a statistical machine learning library that contains k-nearest
neighbor algorithm which is coded in Python (a widely used dynamic programming
language). In pattern recognition, the k-Nearest Neighbors algorithm (or k-NN for
short) is a non-parametric method used for classification and regression. In both
cases, the input consists of the k closest training examples in the feature space. The
output depends on whether k-NN is used for classification or regression: In k-NN
classification, the output is a class membership. An object is classified by a majority
vote of its neighbors, with the object being assigned to the class most common
among its k nearest neighbors (k is a positive integer, typically small). If k = 1, then
the object is simply assigned to the class of that single nearest neighbor. In k-NN

47
regression, the output is the property value for the object. This value is the average
of the values of its k nearest neighbors. Image acquisition A digital image is
produced by one or several image sensors i.e., light-sensitive cameras. The pixel
values typically correspond to light intensity in one or several spectral bands (gray
images or colour images), but can also be related to various physical measures, such
as depth, absorption or reflectance of sonic or electromagnetic waves.
5.3 MODULES:
1.Upload Image
Pre-processing:

Fig 5.3: pre processing

Before a computer vision method can be applied to image data in order to extract
some specific piece of information, it is usually necessary to process the data in
order to assure that it satisfies certain assumptions implied by the following
methods:

● Noise reduction in order to assure that sensor noise does not introduce false
information.

● Contrast enhancement to assure that relevant information can be detected.

● Re-sampling in order to assure that the image coordinate system is correct.

● Scale space representation to enhance image structures at locally appropriate


scales

48
Fig 5.4: number plate

Feature extraction Image features at various levels of complexity are extracted from
the image data. Typical examples of such features are:

1. Lines, edges and ridges.

2. Localized interest points such as corners, points, etc.

3. More complex features may be related to texture, shape or motion.

Detection/segmentation At some point in the processing a decision is made about


which image points or regions of the image are relevant for further processing. For
example:

● Selection of a specific set of interest points

● Segmentation of one or multiple image regions which contain a specific object of


interest. High-level processing at this step the input is typically a small set of data,
a set of points or an image region which is assumed to contain a specific object. The
remaining processing deals with Verification of data that satisfy model-based and
application specific assumptions:

● Estimation of application specific parameters, such as object pose or object size.

● Image recognition: classifying a detected object into different categories.

● Image registration:comparing&combining two different views of the same object.

Decision making: Making the final decision required for the following applications:

• Pass/fail on automatic inspection.

• Match / no-match in recognition.

49
CHAPTER-6
IMPLEMENTATION

6.1 SORCE CODE:


import firebase_admin

from firebase_admin import credentials

from firebase_admin import db

import smtplib

from email.mime.multipart import MIMEMultipart

from email.mime.text import MIMEText

from email.mime.base import MIMEBase

from email import encoders

import pandas as pd

import cv2

import urllib.request

import numpy as np

import os

from datetime import datetime

from PIL.Image import ImageTransformHandler

import cv2

import numpy as np

import pytesseract

50
import easyocr

import paddleocr

from paddleocr import PaddleOCR,draw_ocr

from PIL import Image

pytesseract.pytesseract.tesseract_cmd="C:/Program Files/Tesseract-
OCR/tesseract.exe"

cascade= cv2.CascadeClassifier("haarcascade_russian_plate_number.xml")

states={"AN":"Andaman and Nicobar",

"AP":"Andhra Pradesh","AR":"Arunachal Pradesh",

"AS":"Assam","BR":"Bihar","CH":"Chandigarh",

"DN":"Dadra and Nagar Haveli","DD":"Daman and Diu",

"DL":"Delhi","GA":"Goa","GJ":"Gujarat",

"HR":"Haryana","HP":"Himachal Pradesh",

"JK":"Jammu and Kashmir","KA":"Karnataka","KL":"Kerala",

"LD":"Lakshadweep","MP":"Madhya
Pradesh","MH":"Maharashtra","MN":"Manipur",

"ML":"Meghalaya","MZ":"Mizoram","NL":"Nagaland","OD":"Odissa",

"PY":"Pondicherry","PN":"Punjab","RJ":"Rajasthan","SK":"Sikkim","TN":"Tami
lNadu",

"TR":"Tripura","UP":"Uttar Pradesh", "WB":"West


Bengal","CG":"Chhattisgarh",

"TS":"Telangana","JH":"Jharkhand","UK":"Uttarakhand"}

51
url='http://192.168.70.202/cam-hi.jpg'

# Fetch the service account key JSON file contents

cred = credentials.Certificate('key.json')

# Initialize the app with a service account, granting admin privileges

firebase_admin.initialize_app(cred, {

'databaseURL': "https://trafficsigndetection-e2a2c-default-rtdb.firebaseio.com/"

})

ref = db.reference('Traffic')

def mail_sent(toaddr, filename, path, body):

fromaddr = "[email protected]"

toaddr = toaddr

msg = MIMEMultipart()

msg['From'] = fromaddr

msg['To'] = toaddr

msg['Subject'] = "Over Speed vechile detected"

body = body

msg.attach(MIMEText(body, 'plain'))

filename = filename

attachment = open(path, "rb")

p = MIMEBase('application', 'octet-stream')

p.set_payload((attachment).read())

52
encoders.encode_base64(p)

p.add_header('Content-Disposition', "attachment; filename= %s" % filename)

msg.attach(p)

s = smtplib.SMTP('smtp.gmail.com', 587)

s.starttls()

s.login(fromaddr, "qfbhurcoigibaezh")

text = msg.as_string()

s.sendmail(fromaddr, toaddr, text)

print("sent mail")

s.quit()

def extract_num(img_filename):

img=cv2.imread(img_filename)

#Img To Gray

gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)

nplate=cascade.detectMultiScale(gray,1.1,4)

#crop portion

for (x,y,w,h) in nplate:

wT,hT,cT=img.shape

a,b=(int(0.02*wT),int(0.02*hT))

plate=img[y+a:y+h-a,x+b:x+w-b,:]

#make the img more darker to identify LPR

53
kernel=np.ones((1,1),np.uint8)

plate=cv2.dilate(plate,kernel,iterations=1)

plate=cv2.erode(plate,kernel,iterations=1)

plate_gray=cv2.cvtColor(plate,cv2.COLOR_BGR2GRAY)

(thresh,plate)=cv2.threshold(plate_gray,127,255,cv2.THRESH_BINARY)

#read the text on the plate

read=pytesseract.image_to_string(plate)

read=''.join(e for e in read if e.isalnum())

stat=read[0:2]

cv2.rectangle(img,(x,y),(x+w,y+h),(51,51,255),2)

cv2.rectangle(img,(x-1,y-40),(x+w+1,y),(51,51,255),-1)

cv2.putText(img,read,(x,y-
10),cv2.FONT_HERSHEY_SIMPLEX,0.9,(255,255,255),2)

print(read)

cv2.imshow("plate",plate)

cv2.imwrite("Result.png",img)

cv2.imshow("Result",img)

#ocr = paddleocr.OCR()

#result = ocr.ocr("Result.png")

#ocr = PaddleOCR(use_angle_cls=True, lang='en') # need to run only once to


download and load model into memory

''' ocr = PaddleOCR()

54
img_path = './Result.png'

result = PaddleOCR.ocr(img_path, cls=True)

for line in result:

print(line)'''

def grayscale(img):

img = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)

return img

def equalize(img):

img =cv2.equalizeHist(img)

return img

def preprocessing(img):

img = grayscale(img)

img = equalize(img)

img = img/255

return img

while True:

img_resp=urllib.request.urlopen(url)

imgnp=np.array(bytearray(img_resp.read()),dtype=np.uint8)

imgOrignal=cv2.imdecode(imgnp,-1)

img = np.asarray(imgOrignal)

img = cv2.resize(img, (800, 500))

55
img = preprocessing(img)

cv2.imshow("Processed Image", img)

cv2.imwrite('output.jpg', imgOrignal)

extract_num('output.jpg')

'''ls = ref.get()

print(ls)

value = ls['SPEED_STATUS']

if(value=='OVER'):

mail_sent("[email protected]", "output.jpg",
"output.jpg", "the vechile speed "+ str(70)+ " has been crossed the limit")

print(value)'''

if cv2.waitKey(1) & 0xFF == ord('q'):

break

if cv2.waitKey(0)==113:

exit()

cv2.destroyAllWindows()

56
6.2 SOFTWARE ENVIRONMENT
Python Development Steps:
Guido Van Rossum published the first version of Python code (version 0.9.0) at alt.
sources in February 1991. This release included already exception handling,
functions, and the core data types of list, dict, str and others. It was also object
oriented and had a module system.
Python version 1.0 was released in January 1994. The major new features included
in this release were the functional programming tools lambda, map, filter and
reduce, which Guido Van Rossum never liked. Six and a half years later in October
2000, Python 2.0 was introduced. This release included list comprehensions, a full
garbage collector and it was supporting unicode. Python flourished for another 8
years in the versions 2.x before the next major release as Python 3.0 (also known as
"Python 3000" and "Py3K") was released. Python 3 is not backwards compatible
with Python 2.x. The emphasis in Python 3 had been on the removal of duplicate
programming constructs and modules, thus fulfilling or coming close to fulfilling
the 13th law of the Zen of Python: "There should be one -- and preferably only one
-- obvious way to do it."Some changes in Python 7.3:

• Print is now a function


• Views and iterators instead of lists
• The rules for ordering comparisons have been simplified. E.g. a heterogeneous
list cannot be sorted, because all the elements of a list must be comparable to
each other.
• There is only one integer type left, i.e. int. long is int as well.
• The division of two integers returns a float instead of an integer. "//" can be used
to have the "old" behaviour.
• Text Vs. Data Instead Of Unicode Vs. 8-bit

57
Purpose:
We demonstrated that our approach enables successful segmentation of intra-retinal
layer seven with low-quality images containing speckle noise, low contrast, and
different intensity ranges throughout with the assistance of the ANIS feature.

Python is an interpreted high-level programming language for general-purpose


programming. Created by Guido van Rossum and first released in 1991, Python has
a design philosophy that emphasizes code readability, notably using significant
whitespace.

Python features a dynamic type system and automatic memory management. It


supports multiple programming paradigms, including object-oriented, imperative,
functional and procedural, and has a large and comprehensive standard library.

• Python is Interpreted − Python is processed at runtime by the interpreter. You


do not need to compile your program before executing it. This is similar to
PERL and PHP.
• Python is Interactive − you can actually sit at a Python prompt and interact with
the interpreter directly to write your programs.
Python also acknowledges that speed of development is important. Readable and
terse code is part of this, and so is access to powerful constructs that avoid tedious
repetition of code. Maintainability also ties into this may be an all but useless
metric, but it does say something about how much code you have to scan, read
and/or understand to troubleshoot problems or tweak behaviors. This speed of
development, the ease with which a programmer of other languages can pick up
basic Python skills and the huge standard library is key to another area where
Python excels. All its tools have been quick to implement, saved a lot of time, and
several of them have later been patched and updated by people with no Python
background - without breaking.

58
Modules Used in Project:

TensorFlow:
TensorFlow is a free and open-source software library for dataflow and
differentiable programming across a range of tasks. It is a symbolic math library,
and is also used for machine learning applications such as neural networks. It is
used for both research and production at Google.

TensorFlow was developed by the Google Brain team for internal Google use. It
was released under the Apache 2.0 open-source license on November 9, 2015.

Numpy:

Numpy is a general-purpose array-processing package. It provides a high-


performance multidimensional array object, and tools for working with these arrays.

It is the fundamental package for scientific computing with Python. It contains


various features including these important ones:

▪ A powerful N-dimensional array object


▪ Sophisticated (broadcasting) functions
▪ Tools for integrating C/C++ and Fortran code
▪ Useful linear algebra, Fourier transform, and random number capabilities
Besides its obvious scientific uses, Numpy can also be used as an efficient multi-
dimensional container of generic data. Arbitrary data-types can be defined using
Numpy which allows Numpy to seamlessly and speedily integrate with a wide
variety of databases.

Pandas:
Pandas is an open-source Python Library providing high-performance data
manipulation and analysis tool using its powerful data structures. Python was
majorly used for data munging and preparation. It had very little contribution
towards data analysis. Pandas solved this problem. Using Pandas, we can
accomplish five typical steps in the processing and analysis of data, regardless of
the origin of data load, prepare, manipulate, model, and analyze. Python with

59
Pandas is used in a wide range of fields including academic and commercial
domains including finance, economics, Statistics, analytics, etc.

Matplotlib:
Matplotlib is a Python 2D plotting library which produces publication quality
figures in a variety of hardcopy formats and interactive environments across
platforms. Matplotlib can be

used in Python scripts, the Python and IPython shells, the Jupyter Notebook, web
application servers, and four graphical user interface toolkits. Matplotlib tries to
make easy things easy and hard things possible. You can generate plots, histograms,
power spectra, bar charts, error charts, scatter plots, etc., with just a few lines of
code. For examples, see the sample plots and thumbnail gallery.

For simple plotting the pyplot module provides a MATLAB-like interface,


particularly when combined with IPython. For the power user, you have full control
of line styles, font properties, axes properties, etc, via an object oriented interface
or via a set of functions familiar to MATLAB users.

Scikit – learn:
Scikit-learn provides a range of supervised and unsupervised learning algorithms
via a consistent interface in Python. It is licensed under a permissive simplified
BSD license and is distributed under many Linux distributions, encouraging
academic and commercial use.

Python is an interpreted high-level programming language for general-purpose


programming. Created by Guido van Rossum and first released in 1991, Python has
a design philosophy that emphasizes code readability, notably using significant
whitespace.

Python features a dynamic type system and automatic memory management. It


supports multiple programming paradigms, including object-oriented, imperative,
functional and procedural, and has a large and comprehensive standard library.

60
• Python is Interpreted − Python is processed at runtime by the interpreter. You
do not need to compile your program before executing it. This is similar to
PERL and PHP.
• Python is Interactive − you can actually sit at a Python prompt and interact with
the interpreter directly to write your programs.
Python also acknowledges that speed of development is important. Readable and
terse code is part of this, and so is access to powerful constructs that avoid tedious
repetition of code. Maintainability also ties into this may be an all but useless
metric, but it does say something about how much code you have to scan, read
and/or understand to troubleshoot problems or tweak behaviors. This speed of
development, the ease with which a programmer of other languages can pick up
basic Python skills and the huge standard library is key to another area

where Python excels. All its tools have been quick to implement, saved a lot of time,
and several of them have later been patched and updated by people with no Python
background - without breaking.

Install Python Step-by-Step in Windows and Mac:


Python a versatile programming language doesn’t come pre-installed on your
computer devices. Python was first released in the year 1991 and until today it is a
very popular high-level programming language. Its style philosophy emphasizes code
readability with its notable use of great whitespace.

The object-oriented approach and language construct provided by Python enables


programmers to write both clear and logical code for projects. This software does not
come pre-packaged with Windows.

How to Install Python on Windows and Mac:


There have been several updates in the Python version over the years. The question is
how to install Python? It might be confusing for the beginner who is willing to start
learning Python but this tutorial will solve your query. The latest or the newest version
of Python is version 3.7.4 or in other words, it is Python 3.
Note: The python version 3.7.4 cannot be used on Windows XP or earlier devices.

61
Before you start with the installation process of Python. First, you need to know about
your System Requirements. Based on your system type i.e. operating system and
based processor, you must download the python version. My system type is
a Windows 64-bit operating system. So the steps below are to install python version
3.7.4 on Windows 7 device or to install Python 3. Download the Python Cheat sheet
here. The steps on how to install Python on Windows 10, 8 and 7 are divided into 4
parts to help understand better.

Download the Correct version into the system:

Step 1: Go to the official site to download and install python using Google Chrome
or any other web browser. OR Click on the following link: https://www.python.org

Fig 6.1: official site

Now, check for the latest and the correct version for your operating system.

Step 2: Click on the Download Tab.

62
Fig 6.2: latest version for windows

Step 3: You can either select the Download Python for windows 3.7.4 button in
Yellow Color or you can scroll further down and click on download with respective
to their version. Here, we are downloading the most recent python version for
windows 3.7.4

Fig 6.3: python release by specific number


Step 4: Scroll down the page until you find the Files option.
Step 5: Here you see a different version of python along with the operating system.

63
Fig 6.4: different version of python
• To download Windows 32-bit python, you can select any one from the three
options: Windows x86 embeddable zip file, Windows x86 executable installer or
Windows x86 web-based installer.
•To download Windows 64-bit python, you can select any one from the three
options: Windows x86-64 embeddable zip file, Windows x86-64 executable installer
or Windows x86-64 web-based installer.
Here we will install Windows x86-64 web-based installer. Here your first part
regarding which version of python is to be downloaded is completed. Now we move
ahead with the second part in installing python i.e. Installation
Note: To know the changes or updates that are made in the version you can click on
the Release Note Option.

64
Installation of Python:
Step 1: Go to Download and Open the downloaded python version to carry out the
installation process.

Fig 6.5: installation process


Step 2: Before you click on Install Now, Make sure to put a tick on Add Python 3.7
to PATH.

Fig 6.6: installation process

65
Step 3: Click on Install NOW After the installation is successful. Click on Close.

Fig 6.7 python 3.7.4 is successfully installed


With these above three steps on python installation, you have successfully and
correctly installed Python. Now is the time to verify the installation.
Note: The installation process might take a couple of minutes.

Verify the Python Installation:


Step 1: Click on Start
Step 2: In the Windows Run Command, type “cmd”.

Fig 6.8: starting window

66
Step 3: Open the Command prompt option.
Step 4: Let us test whether the python is correctly installed. Type python –V and press
Enter.

Fig 6.9: testing


Step 5: You will get the answer as 3.7.4
Note: If you have any of the earlier versions of Python already installed. You must
first uninstall the earlier version and then install the new one.

Check how the Python IDLE works:


Step 1: Click on Start
Step 2: In the Windows Run command, type “python idle”.

Fig 6.10: IDLE


Step 3: Click on IDLE (Python 3.7 64-bit) and launch the program
Step 4: To go ahead with working in IDLE you must first save the file. Click on File
> Click on Save

67
Fig 6.11: process
Step 5: Name the file and save as type should be Python files. Click on SAVE. Here
I have named the files as Hey World.
Step 6: Now for e.g. enter print

6.3 TESTING
Software testing is a critical element of software quality assurance and represents
the ultimate reviews of specification, design and coding. Testing presents an
interesting anomaly of the software. During earlier definition and development
phases, it was attempted to build software from abstract concept to a tangible
implementation.
The testing phase involves the testing of the developed system using various set
data. Presentation of test data plays a vital role in system testing. After preparing
the test data the system under study was tested using test data. While testing the
system by using test data errors were found and corrected. A series of tests were
performed for the proposed system before the system was ready for implementation.
The various types of testing done on the system are:
➢ Unit Testing
➢ Integration Testing
➢ User Acceptance Testing
➢ System Testing

68
Unit Testing:
Unit testing focuses verification effort on the smallest unit of software design, the
module. It comprises the set of test performed by the programmer prior to
integration of the unit into larger system. The testing was carried out during the
coding stage itself. In this step each module is found to be working satisfactorily as
regards to the expected output from the module.
Each form is treated as a unit and tested thoroughly for bugs. The following is a
list of some of the test cases :
1) In the login form, if a member does not enter a value for user Id and password,
then the user is prompted with the error message “user Id and password should not
be blank”.
2) In the login form, if a member enters wrong values for user Id and password,
then the user is prompted with the error message “Invalid use rId and password. Try
again.”.
3) In book Entry screen and new student, teacher screen, all the fields should have
a value. Otherwise, the user is prompted with an appropriate error messages.
4) In book transactions form, member id, book no,. issue date, and return date are
mandatory. If not provided, then the system will prompt the user with the error
message “Fields should not be blank”.
Integration Testing:
Integration testing is a systematic technique for constructing the program structure
while at the same time conducting tests to uncover error associated within the
interface. The objective is to take unit tested modules and build a program structure
that has been dictated by design. All modules are combined in this step. The entire
program is tested as whole. And chaos in interfaces may usually result. A set of
errors is encountered in such a case.
The integration testing can be carried out using two methodologies:
# Top Down Integration
# Bottom Up Integration
The first one is done where integration is carried out by addition of major modules
to minor modules. While Bottom Up integration follows combination of smaller

69
ones to larger one. Here, Bottom Up Integration is followed. Even though correction
was difficult because the isolation of causes is complicated by the vastness of the
entire program, all the errors found in the system were corrected and then forwarded
to the next testing steps.
The navigation among all the screens have been thoroughly verified so that the user
of the system can move from one form to another form.
The connectivity between the forms and the database has been checked. In case of
any malfunctions, the user will be informed about the problem.
User Acceptance Testing:
User acceptance of a system is the key factor for the success of any system. The
system under consideration was tested for users acceptance by constantly keeping
in touch with the perspective system user at the time of developing and making
changes wherever required. This is done with the regards to the following points:
A system may be defined as a set of instructions combined in the same form and
directed to some purpose.
Before any development is undertaken certain specifications are prepared which
objectively describe the application system. The System specifications are made
after consulting the end user managers of the relevant departments.
Software to be developed is planned on the basis of requirement of the user. The
problem definition statement description of present situation and goal to be
achieved by news system.
The success of system depends on how accurately a problem is defined, thoroughly
investigated carried out through choice of solution. User need identification and
analysis that are concerned with what the uses needs rather than what he/she wants.
System explains how to perform specific activities or task, which does what and
what.
System Testing:
Testing the behavior of the whole software/system as defined in software
requirements specification (SRS) is known as system testing, its main focus is to
verify that the customer requirements are fulfilled.

70
System testing is done after integration testing is complete. System testing should
test functional and non functional requirements of the software. The test types
followed in system testing differ from organization to organization.
The project is executed and tested on the machines that satisfy the given hardware
and software requirements. It was executed successfully with the specified
hardware and operating system.

6.4 TEST CASES:


USER REQUIREMENTS:

1. Home

Use case ID Helmet Detection And License Plate


Recognition Using Cnn

Use case Name Home button

Description Display home page of application

Primary actor User

Precondition User must open application

Post condition Display the Home Page of an application

Frequency of Use Many times


case

Alternative use case N/A

Use case Diagrams

Attachments N/A

Table 6.1: user requirements

71
CHAPTER-7
RESULT

Fig 7.1: final result

72
CHAPTER-8
CONCLUSION & FUTURE SCOPE
8.1 CONCLUSION:
The message of this research is to show that free and open source technologies are
matured enough for scientific computing domains. The system works satisfactorily
for wide variations in illumination conditions and different types of number plates
commonly found in India. It is definitely a better alternative to the existing
proprietary systems, even though there are known restrictions. This Project provides
an implementation of License Plate Recognition using Optical Character
Recognition (OCR) which is an electronic conversion of images of typed,
handwritten or printed text into machine-encoded text. The project was able to study
and resolve algorithmic and mathematical aspects of the License Plate Recognition
systems, such as problematic of computer vision, pattern recognition, OCR &
Neural networks. License Plate Recognition solution has been tested on static
snapshots of vehicles, which has been divided into several sets according to
difficulty. Sets of blurry and skewed snapshots give worse recognition rates than a
set of snapshots which has been captured clearly. The main objective of this project
was not to find a one hundred percent recognizable set of snapshots, but to test the
invariance of the algorithms on random snapshots systematically classified to the
sets according to their properties. Source code obtained from different references
could extract the characters up to only 5 in number, Improvisation of this source
code is done to extract more than 8 characters to reach Indian standards. This is
achieved by changing the dimensions of best possible outcome of license plate
region.

73
8.2 FUTURE SCOPE:
The future scope of the implemented system can be extended for the recognition of
number plates of multiple vehicles in a single image frame by using multi-level
genetic algorithms. Also, a more sophisticated version of this system can be
implemented by taking inputs from the live video feed and selecting the best vehicle
frame for the classification of the type of vehicle and recognizing the number plates
with the aid of neural networks. It can be further used for vehicle model
identification traffic control, speed control and vehicle location tracking.

This system is cost effective for any country. If the system gets implemented by any
country, then the system should be feed with the official vehicle database which
consist of all the information and details of owner and vehicle, respectively. For
low resolution images, algorithms like super resolution of images should be
implemented.

74
REFERENCES
1. J.Chiverton, “Helmet Presence Classification with Motorcycle Detection And
Tracking”, IET Intelligent Transport Systems,Vol. 6, Issue 3, pp. 259–269, March
2012.

2. Rattapoom Waranusast, Nannaphat Bundon, Vasan Timtong and Chainarong


Tangnoi, “Machine Vision techniques for Motorcycle Safety Helmet Detection”,
28th International Conference on Image and Vision Computing New Zealand, pp
35-40, IVCNZ 2013.

3. Romuere Silva, Kelson Aires, Thiago Santos, Kalyf Abdala, Rodrigo Veras,
Andr´e Soares, “Automatic Detection Of Motorcyclists without Helmet”, 2013
XXXIX Latin America Computing Conference (CLEI).IEEE, 2013.

4. Romuere Silva, “Helmet Detection on Motorcyclists Using Image Descriptors


and Classifiers”, 27th SIBGRAPI Conference on Graphics, Patterns and
Images.IEEE, 2014.

5. Thepnimit Marayatr, Pinit Kumhom, “Motorcyclist‟s Helmet Wearing Detection


Using Image Processing”, Advanced Materials Research Vol 931- 932,pp. 588-
592,May-2014.

6. Amir Mukhtar, Tong Boon Tang, “Vision Based Motorcycle Detection using
HOG features”, IEEE International Conference on Signal and Image Processing
Applications (ICSIPA).IEEE, 2015.

7. Abu H. M. Rubaiyat, Tanjin T. Toma, Masoumeh Kalantari-Khandani,


“Automatic Detection of Helmet Uses for Construction Safety”, IEEE/WIC/ACM
International Conference on Web Intelligence Workshops (WIW). IEEE, 2016.

8. XINHUA JIANG “A Study of Low-resolution Safety Helmet Image Recognition


Combining Statistical Features with Artificial Neural Network”.ISSN: 1473-804x

75
9. Kunal Dahiya, Dinesh Singh, C. Krishna Mohan, “Automatic Detection of Bike-
riders without Helmet using Surveillance Videos in Real-time”, International joint
conference on neural network (IJCNN). IEEE, 2016.

10. Maharsh Desai, Shubham Khandelwal, Lokneesh Singh, Prof. Shilpa Gite,
“Automatic Helmet Detection on Public Roads”, International Journal of
Engineering Trends and Technology (IJETT), Volume 35 Number 5- May 2016,
ISSN: 2231-5381

11. Kuldeepak, Monika Kaushik, and Munish Vashishath (2012), “License Plate
Recognition System based on Image Processing Using Labview” International
Journal of Electronics Communication and Computer Technology (IJECCT)
Volume 2 Issue 4 (July 2012).

12. Muhammad Tahir Qadri, Muhammad Asif, “Automatic Number Plate


Recognition System for Vehicle Identification Using Optical Character
Recognition” 2009 International Conference on EducationTechnology and
Computer.

13. Amar Badr Mohamed M. Abdelwahab, Ahmed M. Thabet, and Ahmed M.


Abdelsadek, “Automatic Number Plate Recognition System”, Annals of the
University of Craiova, Mathematics and Computer Science Series Volume 38(1),
2011, Pages 62{71ISSN: 1223-6934

14. R. Yusnita, Fariza Norbaya, and Norazwinawati Basharuddin (2012),


“Intelligent Parking Space Detection System Based on Image Processing”
International Journal of Innovation, Management, and Technology, Vol. 3, No. 3,
June 2012.

15. Abd Kadir Mahamad, Sharifah Saon, and Sarah Nurul Oyun Abdul Aziz, “A
Simplified Malaysian Vehicle Plate Number Recognition”, Springer International
Publishing Switzerland 2014

16. V. Himani et.al, “Automatic Vehicle Number Plate Localization using


Symmetric Wavelets”, ICT and Critical Infrastructure: Proceedings of the 48th

76
Annual Convention of Computer Society of India, Volume 248 of the series
Advances in Intelligent Systems and Computing pp 69-76, 2014.

17. Smith R, "An Overview of the Tesseract OCR Engine," in IEEE Ninth
International Conference Proceeding of Document anay and Recognition, 2007.

18. Chirag Patel, Atul Patel, and Dharmendra Patel, "Optical Character Recognition
by Open source OCR Tool Tesseract: A Case Study," International Journal of
Computer Applications, Foundation of Computer Science, New York. USA, vol.
55, no. 10, pp. 50-56, October 2012.

19. Prathamesh Kulkarni, Ashish Khatri, Prateek Banga, and Kushal Shah,
"Automatic Number Plate Recognition (ANPR)," in RADIOELEKTRONIKA.
19th International Conference, 2009.

20. Zhen-Xue Chen, Cheng-Yun Liu, Fa-Liang Chang, and Guo-You Wang,
"Automatic License-Plate Location and Recognition Based on Feature Saliance,"
IEEE Transactions on Vehicular Technology, vol. 58, no. 7, pp. 3781-3785, 2009.

21. Ch. Jaya Lakshmi, Dr. A. Jhansi Rani, Dr. K. Sri Ramakrishna, and M.
KantiKiran, "A Novel Approach for Indian License Recognition System,"
International Journal of Advanced Engineering Sciences and Technologies, vol. 6,
no. 1, pp. 10-14, 2011
22. K.V. Suresh, G. Mahesh Kumar, and A.N. Rajagopalan, "Super resolution of
license plates in real traffic videos," IEEE Trans. Intel. Transp. Syst, vol. 8, no. 2,
pp. 321-331, 2007.

23. Yushuang Tian, Kim-Hui Yap, and Yu He, "Vehicle license plate super-
resolution using soft learning prior," Multimedia Tools and Applications, Springer
US, pp. 519535, 2012
24. A Roy and D.P Ghoshal, "Number Plate Recognition for use in different
countries using an improved segmentation," in 2nd National Conference on
Emerging Trends and Applications in Computer Science (NCETACS), 2011, pp. 1-
5.

77
24. Pratiksha Jain, Neha Chopra, Vaishali Gupta” Automatic License Plate
Recognition using OpenCV” International Journal of Computer Applications
Technology and Research Volume 3– Issue 12, 756 - 761, 2014, ISSN:- 2319–8656.
25. Miss. Shraddha S. Ghadage, Mr. Sagar R. Khedkar” Automatic Number Plate
Recognition System using Machine Learning Algorithms” International Journal of
Engineering Research & Technology (IJERT)- ISSN: 2278-0181- Vol. 8 Issue 12,
December-2019.

26. Priyesh Sharma, Vyom Bansal, Sabi Mustaqeem, Karan Maulekhi, Pushpendra
Singh “Automatic License Plate Recognition using OpenCV” International
Research Journal of Engineering and Technology (IRJET)- Volume: 07 Issue: 05 |
May 2020

27. Satadal Saha1, Subhadip Basu, Mita Nasipuri, Dipak Kumar Basu,” License
Plate Localization from Vehicle Images:An Edge Based Multistage Approach”,
International Journal of Recent Trends in Engineering, Vol 1, No. 1, May 2009.

28. G. Naveen Balaji1 & D. Rajesh” Smart Vehicle Number Plate Detection System
for Different Countries Using an Improved Segmentation Method”- Imperial
Journal of Interdisciplinary Research (IJIR) · June 2017.

29. Deniing Jiang, Tulu Muluneh Mekonnen, Tiruneth Embiale, Ashenafi


Gebrehiwot “Car Plate Recognition System” in Fifth internation conference on
Intelligent Networks and Intelligent Systems, IEEE, 978-0-7695-4855-5/12 2012.

30. T.Pratheeba, “Morphology Based Text Detection and Extraction from Complex
Video Scene," International Journal of Engineering and Technology Vol.2 (3), 200-
206, 2010.

78

You might also like