0% found this document useful (0 votes)
14 views71 pages

Plate Recognition Final

The project report details the development of an Automatic Number Plate Recognition System by a group of Master's students at the University of Delhi. The system utilizes image processing and deep learning techniques to automate vehicle access in residential complexes, enhancing security and efficiency. Key components include a Raspberry Pi, camera module, and various software tools, with the project emphasizing hands-on learning during the pandemic.
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)
14 views71 pages

Plate Recognition Final

The project report details the development of an Automatic Number Plate Recognition System by a group of Master's students at the University of Delhi. The system utilizes image processing and deep learning techniques to automate vehicle access in residential complexes, enhancing security and efficiency. Key components include a Raspberry Pi, camera module, and various software tools, with the project emphasizing hands-on learning during the pandemic.
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/ 71

DEPARTMENT OF PHYSICS AND ASTROPHYSICS

UNIVERSITY OF DELHI
DELHI-110 007, INDIA

Automatic Number Plate Recognition


System

A project report submitted to Advanced Electronics II lab teaching team viz. Prof.
Amitabh Mukherjee, Prof. Vinay Gupta, Dr. Mohit Gola, and Dr. Shalu by
group: Electrogeeks in partial fulfillment of the requirements for the Degree of
MASTER OF SCIENCE in PHYSICS

April 25,2021
Details of Group Members:
( in format NAME (Roll No., E-mail Id ,Contact no.))

 AARIF (19036762003,[email protected],8826959152)
 CHINKEY* (19047562003, [email protected], 9992458510)
 HIMANI SHARMA (19026762024, [email protected], 7290991806)
 RUPAL CHAUHAN (19056762058, [email protected], 7011428482)
 SHIVANI SHARMA (19025762038, [email protected], 8130443969)

*Group Leader

The project involved rigorous discussions, experimentations and multiple


executions of each part within our group. Therefore, we cannot segregate the
contribution of each member!

2
Acknowledgements

The project opportunity we had with Advanced Electronics Lab was a wonderful experience.
This was an overwhelming opportunity for all of us. We would like to express our deep and
sincere gratitude to Professor Vinay Gupta and Professor Amitabh Mukherjee for their valuable
inputs, able guidance, encouragement, whole-hearted cooperation and constructive criticism
throughout the duration of our project even in these critical times of pandemic.

It was an every second learning process. Due to pandemic we chose a project with more software
inclination which made us learn many out of the box things that wouldn’t have ever tried.

We express our deepest thanks to our teaching fellows Dr. Mohit Gola and Dr. Shalu for giving
us the timely guidance and support. Last but not the least we express our thanks to our friends for
their cooperation and support.

We would also like to thank the online teaching and learning initiatives including YouTube
Channels and blogs that do helped us a lot throughout this journey.

-ELECTROGEEKS

3
Table of Contents

Abstract .............................................................................................................................................6
Nomenclature ....................................................................................................................................7
List of figures .....................................................................................................................................8
Chapter 1 ......................................................................................................................................... 10
Introduction ............................................................................................................................................ 10
HARDWARE REQUIREMENTS: ............................................................................................................. 10
PROGRAMMING AND SOFTWARE REQUIREMENTS: .......................................................................... 11
PRE-REQUISITES: ................................................................................................................................. 11
PROPOSED METHODOLOGY: .............................................................................................................. 12
Chapter 2 ......................................................................................................................................... 14
Hardware Description ............................................................................................................................. 14
Raspberry pi : ...................................................................................................................................... 14
Camera Module .................................................................................................................................. 16
Ultrasonic sensor ................................................................................................................................ 17
Servo motor ........................................................................................................................................ 18
Chapter 3 ......................................................................................................................................... 20
Software Description .............................................................................................................................. 20
Python ................................................................................................................................................. 20
_Toc70370787LIBRARIES .................................................................................................................... 22
XAMPP................................................................................................................................................. 23
MYSQL ................................................................................................................................................. 24
CREATING DATABASE .......................................................................................................................... 26
CONNECTING DATABASE .................................................................................................................... 26
Chapter 4 ......................................................................................................................................... 28
Python Program (for software part only) ............................................................................................... 28
Approach 1 .......................................................................................................................................... 28
Approach 2: ......................................................................................................................................... 32

Chapter 5 ......................................................................................................................................... 38

4
Updating vehicle status on website ........................................................................................................ 38
Chapter 6 ......................................................................................................................................... 45
Starting up with raspberry pi .................................................................................................................. 45
Raspbian OS ........................................................................................................................................ 45
Setting up of Raspberry Pi................................................................................................................... 48
Installation of Libraries ....................................................................................................................... 49
Installation of OpenCV on Raspberry Pi .............................................................................................. 49
Enabling VNC Server ........................................................................................................................... 50
Installing Tesseract.............................................................................................................................. 51
Installing MySQL.................................................................................................................................. 52
Installing MySQL connector ................................................................................................................ 53
Setting up PhpMyAdmin on the Raspberry Pi .................................................................................... 53
Chapter 7 ......................................................................................................................................... 56
Python code (With integrated hardware)............................................................................................... 56
Code with explanation ........................................................................................................................ 57
Chapter 8 ......................................................................................................................................... 61
Results and Discussion ............................................................................................................................ 61
Chapter 9 ......................................................................................................................................... 67
Problems encountered and Future Scope .............................................................................................. 67

BIBLIOGRAPHY................................................................................................................................. 70

5
Abstract
This project illustrates a design and development of a new efficient Automatic number
plate recognition system, using image processing and deep learning techniques. This system is
implemented at residential parking entries. The Sensor detects the presence of a vehicle and after
that a camera captures the frames of vehicles. This information is sent to Raspberry Pi to process
the image. Using Pytesseract model we detect the number plate of the vehicle. In this system,
open CV and OCR (optical character recognition) platform are used. We create sequential
networks and use libraries that are smart enough to recognize characters. The recognized plate
number is matched with stored database and displays vehicle status on website. If the vehicle is
an un-authenticate one, the gate remains shut and an email is sent to the parking management
authority. If the vehicle is authenticate then servo motors are used to open the gate.

This system can find different applications in different regions. One can use this idea to find
stolen cars. In fact many countries have already implemented this for better traffic control.
Despite of its wide applications, it is a good method to learn and understand different image
processing techniques.

6
Nomenclature

Open CV Open-sourced Computer Vision library


USB Universal data bus
SoC System-on-a-chip
GPU Graphics processing unit
CSI Camera Serial Interface
GPIO General purpose input/output
VNC Virtual network computing
uP Microprocessor
SMTP Simple Mail Transfer Protocol
dB Database
OCR Optical Character Recognition

7
List of figures

S.No. Figure No. Figure Description Page No.


01 Fig.1.1 System flowchart 10
02 Fig.2.1 Raspberry pi 12
03 Fig.2.2 diagram of Raspberry Pi 13
04 Fig.2.3 Camera Module for raspberrypi 14

05 Fig.2.4 Ultrasonic Distance Sensor (HC- 15


SR04)
06 Fig.2.5 Working of ultrasonic sensor 16

07 Fig.2.6 Servo Motors 17


08 Fig.4.1 Output from approach2 36
09 Fig 5.1 Updated php Website 43
10 Fig.6.1 Putty configuration 45
11 Fig.6.2 VNC viewer 46
12 Fig.6.3 WOM wi-fi 46
13 Fig.6.4 Raspberry Pi 47
14 Fig.6.5 Installing Libraries on Pi 50
15 Fig.6.6 Installing phpmyadmin on Pi 53
16 Fig.6.7 Phpmyadmin login page 54
17 Fig.8.1 Desktop view of Pi 60
18 Fig.8.2 Result of Ultrasonic sensor 61
19 Fig.8.3 Output from image processing 61
code
20 Fig.8.4 Final result from image processing 61
code
21 Fig.8.5 MySQL database 62
22 Fig.8.6 Vehicle unauthetication message 62

8
23 Fig.8.7 Detection of Unauthorized vehicle 63
24 Fig.8.8 Unauthentication email generation 63
25 Fig.8.9 Website using Django 64
webframework
26 Fig.8.10 Php website 64
27 Fig.8.11 Final hardware setup 65
28 Fig.9.1 Result using approach 1 66
29 Fig.9.2 Windows on Pi 67
30 Fig.9.3 Distance measurement using 68
arduino uno

9
Chapter 1
Introduction

This chapter gives a glimpse of overall project. It mentions all the


components and pre-requisites that one requires to do this project!

Security is a prime concern in every Apartment and residential complex which require
regulated entry of vehicles. Automatic vehicle access to those residential complexes require a
mechanism devoid of human intervention. Our system is designed to operate automatically on a
24/7 basis and check un-authenticate vehicles from accessing entry. The number plate of the
vehicle is recognized and automatic access to the rightful member is granted. This system
effectuates a competent and methodical paradigm of enhanced structure.
Detecting of number plates on moving vehicles utilizes many algorithms developed for this
purpose. However a lacuna is discernible, and remains an evolving part year on year. Our
Objective is to increase the safety of vehicles. This technology assists in a criminal investigation
and prevents the proliferation of crime.
The craving for residential parking spaces supervised by an automated management system is an
ever increasing need for city residents. The authorized vehicle is registered in the parking
management system along with their owner information. The plate number is used to
automatically enter Authorized vehicle. This system allows residents of that residential complex
easy and secure access to their respective parking slots.

HARDWARE REQUIREMENTS:

 Raspberry pi
 Camera module
 Ultrasonic Sensor
 Servo Motor
 Power Supply:5V (from Laptop)

10
PROGRAMMING AND SOFTWARE REQUIREMENTS:

Programming language:
 Python 3
Software Interfaces:
 MariaDB Database
 Phpmyadmin
 SMTP
 Website
Libraries:
 Open-CV
 Numpy
 Pytesseract
 Haarcascade
 Imutils

PRE-REQUISITES:

 We have worked entirely with python which we have started from scratch. None of us
knew python beforehand. But knowledge of any programming language makes it easier
to comprehend things.
 Soft hand over Linux operating system helps a lot.

11
PROPOSED METHODOLOGY:

Fig 1.1: System Flowchart

The explanation of each block shown above is as follows:

1: start
2: Ultrasonic Sensor is initialised to calculate the distance of the object in front of it
3:If obstacle is present(vehicle in our case) , distance is calculated
4: If the distance lies in already specified range(15cm), camera is initialised
5: Camera is triggered to capture an image of the vehicle
6: This captured image is injected into the python code for image processing
7: Image Processing begins
8: Image of the plate is extracted out of the image of the vehicle
9: Image to text conversion of the license plate

12
10: Text (License plate number) is compared with the already stored database of the authenticate
users of the building
This comprises of an if-else statement

YES- If license plate number matches with any authenticate vehicle

11a:Status of the entry of vehicle is updated on website eith date and time
12a:Servo motor is initialized to open gate
13a:Gate is opened

NO- If license plate number doesn’t match with any authenticate vehicle

11b:it is concluded that vehicle on the gate is not an authenticate vehicle and a security email is
sent to parking authority

14: STOP

13
Chapter 2

Hardware Description

This chapter describes briefly about the functioning of different hardware


components that we have used!

Raspberry pi :

Fig. 2.1: Raspberry pi

Source: www.raspberrypi.org

14
Taking into account the relatively high-performance requirements of image processing in general
and the equipment currently available to the faculty, as a relatively inexpensive and powerful
embedded platform the Raspberry Pi was an obvious choice. The RAM is here used all about
256-512 mb. Here boot media we can used as SD card which cannot be included in the device,
accesses the continuous amount of data as possible. Another contributing factor to this choice
was the availability of the Pi camera module, which can capture high-definition video as well as
stills and requires the user to simply update Raspberry’s firmware to the latest version. It can
easily be used in OpenCV based applications. Although using the officially supported camera
module, which can be accessed through the MMAL and V4L APIs and is supported by numerous
third-party libraries, any USB web-camera can be used (We are using USB we-camera).The
Raspberry Pi is capable of embarking peripherals such as USB ports and also the ability to
integrate features such as actuators and sensors in a set called external links GPIO, including pins
outputs / digital inputs, UART, I2C, SPI, audio, 3V, 5V and GND.

Some of its extended features are listed below

• USB/Ethernet support

• 4 USB ports

• Reverse polarity protection with 2A fuse

• 40 GPIO pins • MicroSD card socket

Fig.2.2: Pinout diagram of Raspberry Pi

Source: www.raspberrypi.org

15
Camera Module

Fig.2.3: Camera Module for raspberrypi

Source : https://www.econespq.com

The 5MP Raspberry Pi 3 Model B Camera Module Rev 1.3 with Cable equips flexible cable for
attaching with Raspberry Pi 3 Model B. The 5MP camera module is perfect for small Raspberry
Pi projects which have very little space allowance just boot up the latest version of Raspbian and
you are good to go!!!
The high-definition 5MP camera delivers outstanding photos but can also shoot video, ideal
for drones or a CCTV project. The lightweight camera module allows for it to be used in more
practical roles, such as a hidden camera or even a camera for a Pi-phone, for example.
This Raspberry Pi Camera Module is a custom designed add-on for Raspberry Pi. It attaches
to Raspberry Pi by way of one of the two small sockets on the board upper surface. This
interface uses the dedicated CSI interface, which was designed especially for interfacing to
cameras. The CSI bus is capable of extremely high data rates, and it exclusively carries pixel
data.
The board itself is tiny, at around 25mm x 23mm x 8mm. It also weighs just over 3g, making it
perfect for mobile or other applications where size and weight are important. It connects to
Raspberry Pi by way of a short flexible ribbon cable. The camera connects to the BCM2835
processor on the Pi via the CSI bus, a higher bandwidth link which carries pixel data from the
camera back to the processor. This bus travels along the ribbon cable that attaches
the camera board to the Pi.
The sensor itself has a native resolution of 5 megapixels and has a fixed focus lens onboard. In
terms of still images, the camera is capable of 2592 x 1944 pixel static images, and also supports
1080p30, 720p60 and 640x480p60/90 video.

16
No adapters required! This camera will plug directly into the Raspberry Pi 3 Model B camera
port!
Hardware connection:
1. Soft cable, 90-degree vertical connector, HDMI port next to it. When connecting the
contact side facing the HDMI interface.
2. Tear protective film on the lens
3. Bare boards, pay attention to ESD damage, beware of static electricity!
Software:
1. RPi firmware and raspi-config has been updated to the camera, do an apt-get update; apt-
get upgrade;
2. Raspi-config, select the camera, start RPi firmware camera driver, and then restart
3. Using the command-line program raspivid and raspistill operate a camera to capture
video clips or images
4. To capture video clips need to play with mplayer
5. How will the data through the network camera live broadcast out:
6. By nc command (ncat – Concatenate and redirect sockets) of the input data of the camera,
directly to the output ports of the network redirection.

Ultrasonic sensor

Fig.2.4 : Ultrasonic Distance Sensor (HC-SR04)

Source : https://www.piborg.org

The HC-SR04 is great, as it's low cost, can be powered via the Raspberry Pi's 5V output, and is
relatively accurate! Please Note. The HC-SR04 has a 5V output (which needs to be reduced to
3.3V to work with the Raspberry Pi).
The HC-SR04 sensor works best between 2cm – 400 cm (1" - 13ft) within a 30 degree cone, and
is accurate to the nearest 0.3cm.
The HC-SR04 uses non-contact ultrasound sonar to measure the distance to an object, and
consists of two ultrasonic transmitters (basically speakers), a receiver, and a control circuit. The
transmitters emit a high frequency ultrasonic sound, which bounce off any nearby solid objects,

17
and the reciever listens for any return echo. That echo is then processed by the control circuit to
calculate the time difference between the signal being transmitted and received. This time can
subsequently be used, along with some clever math, to calculate the distance between the sensor
and the reflecting object!

Fig.2.5 : Working of ultrasonic sensor

Source : https://components101.com

Servo motor

Fig.2.6: Servo Motors

18
Source : https://phi-education.com

Servo motors (or servos) are self-contained electric devices that rotate or push parts of a machine
with great precision. Servos are found in many places: from toys to home electronics to cars and
airplanes. If you have a radio-controlled model car, airplane, or helicopter, you are using at least
a few servos. In a model car or aircraft, servos move levers back and forth to control steering or
adjust wing surfaces. By rotating a shaft connected to the engine throttle, a servo regulates the
speed of a fuel-powered car or aircraft. Servos also appear behind the scenes in devices we use
every day. Electronic devices such as DVD and Blu-ray DiscTM players use servos to extend or
retract the disc trays

The simplicity of a servo is among the features that make them so reliable. The heart of a servo is
a small direct current (DC) motor, similar to what you might find in an inexpensive toy. These
motors run on electricity from a battery and spin at high RPM (rotations per minute) but put out
very low torque . An arrangement of gears takes the high speed of the motor and slows it down
while at the same time increasing the torque. T he gear design inside the servo case converts the
output to a much slower rotation speed but with more torque (big force, little distance). The
amount of actual work is the same, just more useful. Gears in an inexpensive servo motor are
generally made of plastic to keep it lighter and less costly.

19
Chapter 3

Software Description

This chapter briefly describes the computer skills and the software
apllications required for the projects!

Python
Python is an interpreted high-level language. Its high-level built in data structures, combined
with dynamic typing and dynamic binding; make it very attractive for Rapid Application
Development, as well as for use as a scripting or glue language to connect existing components
together. Python's simple, easy to learn syntax emphasizes readability and therefore reduces the
cost of program maintenance. Python supports modules and packages, which encourages
program modularity and code reuse. The Python interpreter and the extensive standard library are
available in source or binary form without charge for all major platforms, and can be freely
distributed

INSTALLATION
 From official site of python.org ,download the 3.8 version of python (exe file).
 Run the file after downloading and check ‘add python 3.8 to path’. Go for customize
installation.
 Install for ‘all users’. Make a new folder for python in pc by browsing and install python.
 One can check whether python is installed properly or not by using window powershell
(by writing python).

Different people in our group used different code editors viz:

20
PYCHARM
PyCharm is an integrated development environment (IDE) used in computer programming,
specifically for the Python language. It provides code analysis, a graphical debugger, an
integrated unit tester, integration with version control systems (VCSes), and supports web
development with Django as well as data science with Anaconda
PyCharm is cross-platform, with Windows, macOS and Linux versions.

INSTALLATION

 From official site of pycharm download community version (as it is free).


 Run the downloaded file and install it, check ‘run pycharm community edition’ and then
‘finish’.
 Check ‘do not import setting‘and then ‘ok’.
 Run pycharm and click on ‘create new project’, give it a name let’s say ‘firsrtprog’.
Check ‘existing interpreter’ and uncheck ‘virtualenvironment’.
 By click on three dots given on right side, click on ‘system interpreter’ and select the
interpreter then click on ‘ok’.
 Click on ‘create ‘and this will make our project.

HOW TO MAKE PROGRAM IN PYCHARM

 Clicks on ‘firstprog’ as creates earlier, then ‘new python file’, name the file lets say
‘main’.

VISUAL STUDIO CODE


Visual Studio Code is a lightweight but powerful source code editor which runs on your desktop
and is available for Windows, macOS and Linux. It comes with built-in support for JavaScript,
TypeScript and Node.js and has a rich ecosystem of extensions for other languages (such as C++,
C#, Java, Python, PHP.

INSTALLATION

WINDOWS
To install Visual Studio Code on Windows 10 , go to the following link:

https://code.visualstudio.com/

 Click on download for Windows. This will download the executable file.

21
 Open the executable file and click on run.
 Click I accept the agreement .
 Click on Next. Select the directory where you want to install Visual Studio Code.
 Click Next and and tick all the boxes in select additional tasks.
 Hit Next and then click on Install.
 Click Finish.

LIBRARIES
 OpenCV
OpenCV is a huge open-source library for computer vision, machine learning, and image
processing. OpenCV supports a wide variety of programming languages like Python, C++,
Java, etc. It can process images and videos to identify objects, faces, or even the handwriting
of a human.

 NumPy
NumPy, which stands for Numerical Python, is a library consisting of multidimensional array
objects and a collection of routines for processing those arrays. Using NumPy, mathematical and
logical operations on arrays can be performed.

 imutils
A series of convenience functions to make basic image processing functions such as translation,
rotation, resizing, skeletonization, and displaying Matplotlib images easier with OpenCV and
both Python 2.7 and Python 3.

 Pytesseract
Python-tesseract is an optical character recognition (OCR) tool for python. That is, it will
recognize and “read” the text embedded in images.Python-tesseract is a wrapper for Google’s
Tesseract-OCR Engine.

INSTALLATION

WINDOWS
Open Command prompt or Window Powershell .

OpenCV : pip install opencv-contrib-python

NumPy : pip install numpy

imutils : pip install imutils

22
Pytesseract : pip install pytesseract

TESSERACT
Tesseract is an optical character recognition engine which can be used on various operating
systems.It can recognize and “read” the text embedded in images.It has the ability to
recognize more than 100 languages out of the box. It can be trained to recognize other languages.

INSTALLATION

WINDOWS
To install Tesseract 4 on our Windows system, go to the following link:

https://digi.bib.uni-mannheim.de/tesseract/

 Download windows executable file by clicking the hyper link titled tesseract-ocr-w64-setup-
v4.1.0.20190314.exe.
 A notification asking you to save an exe file called “Tesseract-ocr-w64-setup-
v4.1.0.20190314.exe” will appear. Save this .exe file wherever you have enough storage
space.
 Open this exe file. If it windows asks you “Do you want to allow this software to make
changes to your system”, click yes. You will be taken to the installation section.
 Hit next, click I agree to the terms and conditions and after selecting for whom and all you
want to install Tesseract (anyone using this computer/just for me. You can select either one),
click next.
 Tick the boxes that say “ScrollView”, “Training Tools”, “Shortcuts creation” and importantly
“Language data”. These should be ticked by default but just do them just in case they haven’t
been ticked in your system.
 Click on Next. Select the directory where you want to install Tesseract. Do take note of the
path where you installed Tesseract on your machine. This is important.

XAMPP
XAMPP is an acronym, in which "X" stands for Cross platform, "A" stands for Apache server,
"M" stands for MariaDB, "P" stands for Perl, and "P" stands for PHP. It is a stack of software,
which includes Apache distributions used to develop and test website locally before its
deployment on the internet.

23
INSTALLATION

WINDOWS
 Go to the Apache Friends website and download the file for Windows.
 Open the executable file.
 When setup wizard pops up, click “Next”, and in the next window, you will be asked to
select components you want to install.
 Options like Apache and PHP are required and are installed automatically.
Check MySQL and phpMyAdmin boxes.

 Click Next and select the path where you would like to install XAMPP.
 Click Next and check “Learn more about Bitnami for XAMPP”. The extension makes
installing third-party CMS programs WordPress, Joomla!, Drupal without a hassle.
 Click Next and now installation will start.
 After the installation, you will be asked if you would like to start the XAMPP Control Panel.
Leave the box checked and click “Finish”.

MYSQL
MySQL is an open-source relational database management system (RDBMS).

A relational database organizes data into one or more data tables in which data types may be
related to each other; these relations help structure the data. SQL is a language programmers use
to create, modify and extract data from the relational database, as well as control user access to
the database. In addition to relational databases and SQL, an RDBMS like MySQL works with
an operating system to implement a relational database in a computer's storage system, manages
users, allows for network access and facilitates testing database integrity and creation of
backups.

POPSQL

PopSQL is a modern SQL editor for teams. It lets you write queries, organize them in folders,
visualize your data, and collaborate with your team.

* Compatible with macOS, Windows, and Linux

* Works with PostgreSQL, Redshift, MySQL, BigQuery, SQL Server, SQLite, Presto, Cassandra

* Organize your queries in folders

* Get a URL to share your query or results with your team

24
PopSQL is a versatile SQL management tool that will make it possible for you to work and
collaborate on multiple database management tasks simultaneously.

It is one of those applications that will enable you to manage multiple databases at the same time.

INSTALLATING MYSQL

 Download mysql community server form official site. Download ‘mysql installer’
according to the version of your pc. Accept the license. Use ‘custom install’
 21Select ‘mysql server’ (according to downloaded version), ‘mysqlshell’ and
‘mysqlworkbench’ from ‘applications’ then ‘next’ followed by ‘execute’ and install
them. By clicking ‘next ‘, create root password (root is a default admin account). Install
it.
 Whenever we open mysql we need to provide password. After opening mysql, enter
password, and type ’create database project’ (here we given name of database as project)
and our database is created.
 We can use mysql also but PopSQL is text editor that will connect to our database server
and will able to write inside that.

INSTALLING POPSQL
 From official site download PopSQL and install it. Sign in with Google.
 Connect it to database by providing database name, password, username and click
‘connect’, database will be connected.

CREATING TABLE IN POPSQL


We will use command create table for creating table.

Different type of data that can be stored in the database:

 INT: refer to integers (any whole no.)


 DECIMAL (M, N): to store decimal no, m is total no of digits that we want to store, n is
no of digits after the decimal point.
 VARCHAR (a): variable character, use to store string of text length ‘a’.
 BLOB: binary large object, store large amount of binary data like images
 DATE: YYY-MM-DD
 TIMESTAMP: used for recording ,YYY-MM-DD HH-MM-SS

 Statement ends with’;’


 ‘Drop table’ is used to remove table.

25
 ‘Alter table *table name* ADD *field*’ is used to alter the table with additional block.

CREATING DATABASE

CONNECTING DATABASE

We will be connecting our database to python code via mysql connector using code in power
shell.

This will help us to check whether the entering car is in authenticate or not.

26
In above code we have imported our mysql.connector and renamed it as ‘c’. We have given the
details of our database and password for it. ‘CURSOR’ is a method which gives cursor to work
with code; it is like, it points to database. we have obtained license plate number(from python
code) as ‘read’ and storing it as ‘inputvalue’ , storing fetched information from database in
‘myresult’ as ‘x’ , comparing ‘inputvalue’ and ‘x ‘ will print whether the license plate is
authenticate or not.

27
Chapter 4

Python Program (for software part only)

This chapter contains the explanation for python program written for
software part of the project. Program has been tried with two different
approaches. Comparison of both the approaches is shown. Conclusion of
choice of approach is made at the end of the chapter!

Approach 1
Our aim is to first detect the number plate of the car and after that recognize characters.

We have used contour method for detecting the number plate before which some image
processing is done. After detecting the number plate pytesseract is used to convert image to
string.

CODE :
import cv2
import pytesseract
pytesseract.pytesseract.tesseract_cmd=r'C:\Users\ATUL SHARMA\PycharmProjects\tesseract.exe'

#Read the image file


image=cv2.imread('download.jpg')

#Convert to grayscale image


gray_image=cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)

#Removes noise
gray_image=cv2.bilateralFilter(gray_image,11,17,17)
cv2.imshow("grayimage",gray_image)
cv2.waitKey(0)

#Canny Edge detection


canny_edge=cv2.Canny(gray_image,100,200)

28
cv2.imshow("canny edge",canny_edge)
cv2.waitKey(0)

#Find contours based on edge


contours,hierachy=cv2.findContours(canny_edge.copy(),cv2.RETR_LIST,cv2.CHAIN_APPRO
X_SIMPLE)
contours=sorted(contours,key=cv2.contourArea,reverse=True)[:30]
image_copy=image.copy()
cv2.drawContours(image_copy,contours,-1,(255,0,255),2)
cv2.imshow("contours",image_copy)
cv2.waitKey(0)

plate=None
for c in contours:
perimeter=cv2.arcLength(c,True)
edges_count=cv2.approxPolyDP(c,0.02*perimeter,True)
if len(edges_count)==4:
x,y,w,h=cv2.boundingRect(c)
plate=image[y:y+h,x:x+w]
break

cv2.imshow("plate",plate)
cv2.waitKey(0)

#Text recognition
text=pytesseract.image_to_string(plate,lang='eng')
print(text)

EXPLANATION

Let us understand the code stepwise.

 STEP 1 : Import libraries

import cv2
import pytesseract
pytesseract.pytesseract.tesseract_cmd=r'C:\Users\ATUL SHARMA\PycharmProjects\tesseract.exe'

29
 STEP 2 : Read in Image, grayscale and remove noise

image=cv2.imread('download.jpg')
gray_image=cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
gray_image=cv2.bilateralFilter(gray_image,11,17,17)
cv2.imshow("grayimage",gray_image)

 STEP 3 : Apply filter and find edges for localization

canny_edge=cv2.Canny(gray_image,100,200)
cv2.imshow("canny edge",canny_edge)

30
 STEP 4 : Find Contours

contours,hierachy=cv2.findContours(canny_edge.copy(),cv2.RETR_LIST,cv2.CHAIN_APPRO
X_SIMPLE)
contours=sorted(contours,key=cv2.contourArea,reverse=True)[:30]
image_copy=image.copy()
cv2.drawContours(image_copy,contours,-1,(255,0,255),2)
cv2.imshow("contours",image_copy)

 STEP 5 : Locate Number Plate

plate=None
for c in contours:
perimeter=cv2.arcLength(c,True)
edges_count=cv2.approxPolyDP(c,0.02*perimeter,True)
if len(edges_count)==4:
x,y,w,h=cv2.boundingRect(c)
plate=image[y:y+h,x:x+w]
break

cv2.imshow("plate",plate)

31
 STEP 6 : Use Pytesseract to read text

text=pytesseract.image_to_string(plate,lang='eng')
print(text)

Approach 2:

Due to not so good sensitivity of detection of Plate Numbers we switched to another code
which includes new libraries called imutils and haarcascade as dicussed below.

Prerequisites for this code:


Installing OpenCV in Raspberry Pi 3
Here OpenCV library is used to detect and recognize faces. To install the OpenCV, first, update
the Raspberry Pi.

sudo apt-get update

Then use the following commands to install the required dependencies for installing OpenCV on
your Raspberry Pi.

32
sudo apt-get install libhdf5-dev -y
sudo apt-get install libhdf5-serial-dev –y
sudo apt-get install libatlas-base-dev –y
sudo apt-get install libjasper-dev -y
sudo apt-get install libqtgui4 –y
sudo apt-get install libqt4-test –y

After that, use the below command to install the OpenCV on your Raspberry Pi.

pip3 install opencv-contrib-python==4.1.0.25

Installing Tesseract
To install the Tesseract, first, configure the Debian Package (dpkg) using the below command:

sudo dpkg - -configure –a

After that, install the Tesseract OCR (Optical Character Recognition) using the apt-get option.

sudo apt-get install tesseract-ocr

After that, install the pytesseract using the pip.

pip install pytesseract

After this, install the PYTTSX3 library for text to speech conversion using the below command:

pip install pyttsx3

Installing imutils
imutils is used to make essential image processing functions such as translation, rotation,
resizing, skeletonization, and displaying Matplotlib images easier with OpenCV. Use the below
command to install the imutils:

33
pip3 install imutils

Haar Cascade XML File

OpenCV actually comes with pre-trained XML files of various Haar Cascades, where each XML
file contains the feature set. We will be using the Haar Cascade XML file containing the features
for Russian car plates, and here’s how you can download the Haar Cascade XML file:

1. Visit the OpenCV GitHub page containing the Russian car plate Haar Cascade.

2. Right click on the screen (which should be displaying a wall of text with the top line being
<?xml version=”1.0"?>), and click ‘Save as..’

3. In the Save option pop-up, you should see the default file name of
‘haarcascade_russian_plate_number’ and file type ‘XML document’.

Code with Explanation:


The above dependencies can then be initialized with the following code:

Now, we bring in the Haar Cascade feature set (XML file) for Russian car plates,
with the use of OpenCV’s CascadeClassifier function and tesseract.exe by calling
the address where it is saved during installation

34
We import the input car image we want to work with.

Because OpenCV imports images as BGR (Blue-Green-Red) format by default, we


will need to run cv2.cvtColor to switch it to RGB format before we ask matplotlib
to display the image.

Next we make use of the detectMultiScale method of the CascadeClassifier to run


the detection.

The method allows us to detect objects of different sizes in the input image, and it
returns a list of rectangle bounds where objects are detected. For each
rectangle, there will be 4 values returned, and they correspond to the following
respectively:
 x-coordinate of bottom-left corner of rectangle (x)
 y-coordinate of bottom-left corner of rectangle (y)
 width of rectangle (w)
 height of rectangle (h)

35
In order to ensure the success of the OCR function, we need to perform a series
of image processing steps. Let’s start by isolating the car license plate as an
image. We do that by setting up a function similar to what we have done earlier
with car plate detection, just that this time we will be extracting and returning the
region of interest (car plate) as a new image.

After these transformations, our image is now ready for OCR application. For
other images, if higher degree of smoothing is required, you can always increase
the kernel size from the size 3 I used here. Let’s pass the image into the
PyTesseract image_to_string function:

This completes the program.

Output:

36
Fig:4.1 Output of code suing approach 2

This is the same image that we tried with the code mentioned in approach 1.
That code wasn’t able to detect the number plate correctly specially the alphabets
like O, D, Q. But this approach has shown a fantastic sensitivity.

So, we here conclude that approach 2 is better and more suitable for our
purpose. Thus, henceforth we will carry on with approach 2.

37
Chapter 5

Updating vehicle status on website

This chapter aims at building up the understanding of web -development


where in we have tried to host a web server on our la ptop!

Our aim is to first identify whether the car is authenticate or not. If car is authenticate ,then
update its status on our website which includes number plate, owner’s name, contact
number,email id and the most important date and time at which the car entered.

PROGRAMMING LANGUAGES USED

HTML

HTML (HyperText Markup Language) is the most basic building block of the Web. It defines the
meaning and structure of web content.

"Hypertext" refers to links that connect web pages to one another, either within a single website or
between websites. Links are a fundamental aspect of the Web. By uploading content to the
Internet and linking it to pages created by other people, you become an active participant in the
World Wide Web.

HTML uses "markup" to annotate text, images, and other content for display in a Web browser.

38
PHP

PHP stands for Hypertext Pre-processor, that earlier stood for Personal Home Pages.
It is a widely-used open source general-purpose scripting language that is especially suited for
web development and can be embedded into HTML

Now let us understand the process stepwise.

 STEP 1 : Identify whether the Car is authenticate or not

Compare the number plate of the Car with the stored database. If it matches then the Car is
authenticate.

 STEP 2 : Store the data in another table

Insert the data of the Car from the original database into another table including the date and
time of Car’s arrival.

CODE :
import mysql.connector as c
import datetime
now=datetime.datetime.now()
Date=now.strftime("%d/%m/%y")
Time=now.strftime("%H:%M %p")
print(Date)
print(Time)
con=c.connect(host="localhost",user="root",passwd="",database="license")
if con.is_connected():
print("succesfully connected..")
else:
print("connectivity issue")

inputvalue = read
mycursor=con.cursor()
mycursor.execute("SELECT * FROM `number` ")
myresult=mycursor.fetchall()
for x in myresult:
if inputvalue in x:
id=x[0]

39
lic_number=x[1]
Name=x[2]
Contact=x[3]
Email=x[4]

sql="INSERT INTO data (lic_number,Name,Contact,Email,Date,Time) VALUES


('{}','{}',{},'{}','{}','{}')".format(lic_number,Name,Contact,Email,Date,Time)
mycursor.execute(sql)
con.commit()
print("Car is authenticate")
break
else:
print("Car is not authenticate")

NOTE : In this program inputvalue is the Car’s number plate , “license” is


database , “number” is original table where the information of all the cars is
stored , “data” is the table where the information of the car including date and
time is stored if Car is authenticate.

RESULT :

40
 STEP 3 : Display data from database to web page

First we would fetch data from database and then display it on our website using PHP and
HTML.

 Create a new folder in C:\xampp\htdocs and name it say LIC.


 Open XAMPP and start the Apache and MySQL server.
 Open Visual Studio Code and create a new PHP file say connection.php and save it in the
folder LIC.
 Connection is build between database and website using PHP.
 Create another PHP file say ANPR.php and save it in the folder LIC.
 Use connection.php to fetch data from table “status”.
 Display the fetched data on website using HTML and PHP.

CODE :

 Connection.php

41
 ANPR.php

42
43
VEHICLE STATUS UPDATED ON WEBSITE

Fig 5.1:Updated PHP website

44
Chapter 6

Starting up with raspberry pi

This piece introduces you to the setting up /access of Raspberry Pi and the
way to use laptop peripherals to access raspberry!

Raspbian OS
Raspberry Pi needs an operating system to work. Many operating systems are available for
Raspberry Pi, including Raspberry Pi OS, official supported operating system, and operating
systems from other organizations.

PuTTY
PuTTY is an SSH and telnet client, developed originally by Simon Tatham for the Windows
platform. PuTTY is open-source software that is available with source code and is developed and
supported by a group of volunteers.

45
Figure 6.1: Putty configuration
The name "PuTTY" has no official meaning. SSH (Secure Shell Protocol) provides a secure
channel over an unsecured network by using a client–server architecture, connecting an SSH
client application with an SSH server. The encryption used by SSH is intended to provide
confidentiality and integrity of data over an unsecured network, such as the Internet.

VNC Server
VNC (Virtual Network Computing) is a graphical desktop sharing system that allows us to
remotely control the desktop interface of one computer (running VNC Server) from another
computer or mobile device (running VNC Viewer). VNC Viewer transmits the keyboard and
either mouse or touch events to VNC Server, and receives updates to the screen in return. We
must enable VNC Server before you can use it. By default, VNC Server gives us remote access
to the graphical desktop that is running on our Raspberry Pi, as though we were sitting in front of
it. To connect to Raspberry Pi, we will need its IP Address.

46
Figure 6.2 VNC Viewer

WOM Wi-Fi

Network and Wi-Fi Scanner that helps in identifying, who is on the Wi-Fi and gives details of all
the devices connected to the Wi-Fi. We can access IP Address of Raspberry Pi and other details
using this application.

Figure 6.3 WOM Wi-Fi

47
Setting up of Raspberry Pi
Raspberry Pi have developed a graphical SD card writing tool that works on Mac OS, Ubuntu
18.04 and Windows, and it is the easiest option as it will download the image and install it
automatically to the SD card.

 Download the latest version of Raspberry Pi Imager and install it.

Figure 6.4: Raspberry Pi Imager

 Connect a SD card reader with SD card inside.


 Open the Raspberry Pi Imager and choose the required OS from the list presented.
 Choose the SD card you wish to write your image to.
 Review your selections and click ‘WRITE’ to begin writing data to SD card.

Boot OS

Insert the SD card into the Raspberry Pi and power it up. Enter the Default Username and
Password to login to Raspberry Pi.

SSH

Make sure you have SSH enabled if not then Create a new text Document, name it SSH.
Remove file extension .txt from this text document.

WPA supplicant

Auto connect Raspberry Pi to home Wi-Fi

48
 Download the code and unzip it: https://github.com/apurva-v8/WPA-supplicant-
raspberry-pi--supports-all-models-/blob/master/wpa_supplicant.conf
 Change the SSID and password of your wi-fi to your home wi-fi
 Copy and paste the wpa_supplicant.conf file into the boot partition of Raspberry

Installation of Libraries
Installation of OpenCV on Raspberry Pi
Connect Raspberry Pi to your Laptop using PuTTY by inserting IP address of Pi. We can easily
find out the address of our Pi by using WOM application.

After connecting Pi to our Desktop do as follows:

 Prepare the System for installation

1. sudo apt-get -y purge wolfram-engine


2. sudo apt-get -y purge libreoffice*
3. sudo apt-get -y clean
4. sudo apt-get -y autoremove
5. echo "OpenCV installation by learnOpenCV.com"
6. cvVersion="masrer"

 Clean build directories and create installation directory

1. rm -rf opencv/build
2. rm -rf opencv_contrib/build
3. view sourceprint?
4. mkdir installation
5. mkdir installation/OpenCV-"$cvVersion"

 Storing current working directory in cwd variable

cwd=$(pwd)

 Update packages

1. sudo apt -y update


2. sudo apt -y upgrade
49
 Install OS libraries

sudo apt-get -y remove x264 libx264-dev

## Install dependencies

1. sudo apt-get -y install build-essential checkinstall cmake pkg-config yasm


2. sudo apt-get -y install git gfortran
3. sudo apt-get -y install libjpeg8-dev libjasper-dev libpng12-dev
4. sudo apt-get -y install libtiff5-dev
5. sudo apt-get -y install libtiff-dev
6. sudo apt-get -y install libavcodec-dev libavformat-dev libswscale-dev
libdc1394-22-dev
7. sudo apt-get -y install libxine2-dev libv4l-dev
8. cd /usr/include/linux
9. sudo ln -s -f ../libv4l1-videodev.h videodev.h
10. cd $cwd
11. sudo apt-get -y install libgstreamer0.10-dev libgstreamer-plugins-
base0.10-dev
12. sudo apt-get -y install libgtk2.0-dev libtbb-dev qt5-default
13. sudo apt-get -y install libatlas-base-dev
14. sudo apt-get -y install libmp3lame-dev libtheora-dev
15. sudo apt-get -y install libvorbis-dev libxvidcore-dev libx264-dev
16. sudo apt-get -y install libopencore-amrnb-dev libopencore-amrwb-dev
17. sudo apt-get -y install libavresample-dev
18. sudo apt-get -y install x264 v4l-utils

 Install OpenCV for Python

1. sudo apt-get install libhdf5-devlibhdf5-serial-devlinhdf5-100


2. sudo apt-get install libqtgui4 libqtwebkit4 libqt4-test
3. sudo apt get install linjasper-dev
4. wget https://bootstrap.pypa.io/get-pip.py
5. sudo python3 get-pip.py
6. pip install opencv-python

Enabling VNC Server


We can enable VNC Server at the command line using

50
sudo raspi-config

Now, enable VNC Server by doing the following:

• Navigate to Interfacing Options.

• Scroll down and select VNC > Yes.

Connecting VNC Viewer with raspberry pi

• On the device you’ll use to take control, download VNC Viewer. For best results, use the
compatible app from RealVNC.
• Enter your Raspberry Pi’s private IP address into VNC Viewer.

Installing Tesseract
To perform Optical Character Recognition on Raspberry Pi, we have to install the Tesseract
OCR engine on Pi. To do this we have to first configure the Debian Package (dpkg) which will
help us to install the Tesseract OCR. Use the below command on the terminal window
to configure Debian Package.
sudo dpkg - -configure –a

Then we can proceed with installing the Tesseract OCR (Optical Character Recognition) using
the apt-get option. The command for the same is given below.
sudo apt-get install tesseract-ocr

Fig6.5: Installing libraries on Pi

51
Now that we have the Tesseract OCR installed, we have to install the PyTesseract package using
the pip install package. Pytesseract is a python wrapper around the tesseract OCR engine, which
helps us to use tesseract with python. Follow the below command to install PyTesseract on
python.

Pip install pytesseract

Installing MySQL
 Before we get started with installing MySQL to our Raspberry Pi, we must first
update our package list and all installed packages.

1. sudo apt update


2. sudo apt upgrade

 The next step is to install the MySQL server software to your Raspberry Pi.

sudo apt install mariadb-server

 With the MySQL server software installed to the Raspberry Pi, we will now need
to secure it by setting a password for the “root” user. By default, MySQL is
installed without any password set up meaning you can access the MySQL server
without any authentication.
Run the following command to begin the MySQL securing process

sudo mysql_secure_installation

Just follow the prompts to set a password for the root user and to secure your
MySQL installation. For a more secure installation, you should answer “Y” to all
prompts when asked to answer “Y” or “N “.
These prompts will remove features that allows someone to gain access to the
server easier.
Make sure you write down the password you set during this process as we will
need to use it to access the MySQL server and create databases and users for
software such as WordPress or PhpMyAdmin.

52
 Now if you want to access your Raspberry Pi’s MySQL server and start making
changes to your databases, you can enter the following command.

sudo mysql -u root -p

You will be prompted to enter the password that we just created for MySQL’s
root user.

 There are two different ways you can quit out of the MYSQL command line, the
first of those is to type “quit;” into the MySQL interface. The other way of
quitting out of the MYSQL command line is to press CTRL + D.

Installing MySQL connector


In MySQL, to activate the remote connection to the database, it mean from another machine not
connected to our Raspberry Pi.
The remote connection can be very useful if you have a server without an internal database.

sudo apt-get -y install python3-mysql.connector

Setting up PhpMyAdmin on the Raspberry Pi


 To install the PHPMyAdmin package to our Raspberry Pi, we need to run the
command below

sudo apt install phpmyadmin

 PhpMyAdmin will now begin to install to your Pi. It will require your input on
various steps along the way. You will be presented with a screen asking the type
of web server you want it to run off.

 Select the “apache2” option by pressing SPACE and then ENTER. Select this
option even if you are using NGINX as we will configure that ourselves latest on.
 Next, we will need to configure PhpMyAdmin to connect to our MYSQL server.
We will also need set up some details so that we can log in to the PhpMyAdmin
software. To do this select “<Yes>” at the next prompt.

53
Fig 6.6: Installing phpmyadmin on Pi

 It will now ask you to set a password for PhpMyAdmin itself. It is best to set this
password to something different to your root SQL password. Doing this will help
secure the server. This password is what PhpMyAdmin will use to connect to the
MySQL server.

 With the PHPMyAdmin installation process complete, there is one last thing we
need to do. PHPMyAdmin by default will block you from logging into the
PHPMyAdmin interface using the “root” user. Instead, you will need to create a
new user if you wish to create and access data tables within PHPMyAdmin. To do
this, we will need to first login to the MySQL command line interface using the
“root” user with the password you set up.

sudo mysql -u root -p

 Now run the command below to create a user and permit it to access all databases
on the MySQL server. Remember the details you enter here as you will use these
to log in to PHPMyAdmin
Make sure you replace “username” with the username of your choice. Also,
replace “password” with a secure password of your choice.

GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' IDENTIFIED BY


'password' WITH GRANT OPTION;

54
 You can exit out of the MySQL command line interface by typing “quit” in the
terminal.
Accessing PHPMyAdmin

You should now be able to access your Raspberry Pi’s PHPMyAdmin interface from a web
browser. Remember to replace the IP Address with your Raspberry Pi’s IP Address.

http://192.168.1.108/phpmyadmin

Fig 6.7:phpmyadmin login page

55
Chapter 7

Python code (With integrated hardware)

This chapter explains the working and setup of the final code that we have
inserted into Raspberry Pi 3!

There are some prerequisites to be followed before running this program:

To use the SMTP services on Raspberry Pi, we first have to install the SMTP library on Pi. Use
the below command to install the same:

Before this Open CV , Tesseract and MySQL needs to be installed which we have already
discussed earlier in previous chapters.

sudo apt-get install ssmtp

Now we have to edit the configure file. For that, open Configuration file using the below
command:

sudo nano /etc/ssmtp/ssmtp.conf

And add the below lines. Don’t forget to add your email and email password.

root=postmaster
mailhub=smpt.gmail.com:587
[email protected]
AuthPass=youremailpassword
FromLineOverride=YES
UseSTARTTLS=YES

56
Code with explanation:
Final code that we used is explained below. It includes integration of all hardware components,
MYSQL database, SMTP.

At the starting of the code, all the required packages for this project are imported.

Micro-Servo Motor attached at GPIO pin 17 of Raspberry Pi is initialised. Function “SetAngle”


is constructed to rotate servo motor at desired angle. This function will be called later when
needed.

These three sentences are used to establish the connection of Raspberry with Ultrasonic Sensor
connected at GPIO pin 21(Trig pin of sensor) and GPIO pin 20(echo pin of sensor).

57
As soon as system is powered up Ultrasonic sensor starts measuring the distance of the object in
front of it. A short pulse is sent from the trig pin of the sensor which is received back at the echo
pin after striking back from the obstacle. Time taken by this process (from transmission of the
pulse to its reception) is measured. And using simple speed and distance relationship , distance
of the object from the sensor is calculated in cms.

When the distance is less than 15 cms, SMTP is initialized and account provided in email id and
password in server.login is logged in.

58
Then initialize the camera object and set the resolution at (640, 480) and the picture taken is
saved as image.jpeg this image is injected to the image to text conversion code we already have.

This is our basic code as already explained in Chapter 6. This is used to convert image of the car
to text containing license plate number.

59
MySQL database containing information about all the authorized users of the building is called
in these lines of the code and connected. If connection is failed, it says “connectivity issue”
“License” is the table storing all the information of the users. Text we got from the previous part
is compared with the data in the database.

If the license plate number matches, then servo motor is set to rotate by an angle of 120 degrees
using the function SetAngle constructed above.

If license plate number obtained above doesn’t match, then a security email is sent to the two E-
mail Ids mentioned in the code above.

60
Chapter 8

Results and Discussion

This chapter contains the screenshots and pictures of all the results we have
obtained till now. Captions of the images are self explanatory!

Fig 8.1: Image showing desktop view of Raspberry Pi 3 OS projected on a


Windows Laptop

61
Fig 8.2: Results of distance measurement obtained from Ultrasonic sensor.

Fig 8.3: a) Picture of the number plate extracted from the image of the car b)
Grayscale version of Picture of the number plate

Fig 8.4: Pictures of final results from image to text conversion for two different
vehicle images

62
Fig 8.5: Screenshot of MySQL Database on phpMyAdmin Page

Fig 8.6: Screenshot of Vehicle Authentication message

63
Fig 8.7: Screenshot of detection of unauthorized vehicle

Fig 8.8: Screenshot of vehicle un-authentication Email

64
Fig 8.9: Screenshot of Website developed using Django web framework used
earlier

Fig 8.10: Screenshot of Updated PHP website

65
Fig 8.11: Pictures of final Hardware setup

Here-in we attach the Google drive link for the video showing the full working of
our project!

https://drive.google.com/drive/folders/1Y9eoQ_bfpXb40P-9XkyRF-
d5xqBfT58y?usp=sharing

66
Chapter 9

Problems encountered and Future Scope

In this chapter we discuss the problems that we have faced through the
making of this project and some additional features that can be added to
improve its functionalities!

Problems Encountered:
o Sensitivity of the image to text conversion was a challenge in the beginning but was
improved by enhancing the detailing of image by using imutils library which works on
the principle of magnifying the image first and then sampling.

Fig 9.1: Picture showing the results of license number detection using
approach 1 (Not so good sensitivity was obtained)

67
o We used our laptop as a monitor screen for Raspberry which resulted into some OS
interface problems which led us to try different OS on Laptop and Raspberry itself
including Linux and Windows.
o Windows in Raspberry solved the interface issues but didn’t suit our project as the python
version we required wasn’t available for Raspberry-compatible Windows OS.
Raspbian OS-32 bit worked best for us.

o Camera module we used is a very delegate CCD camera. It needs to be prevented from
voltage fluctuations and proper steps are required to be performed to mount it onto
Raspberry (Although even after taking precautions ,we ended up damaging 1 camera
module)

Fig 9.2: Screenshot showing installation failure for setting up python on


windows OS on Raspberry Pi

o Before using Raspberry we tried our stuff on a simpler board – ATmega328P


Microcontroller Arduino Uno. But due to following limitations we switched to
Raspberry Pi:
 Unlike Raspberry Pi, Arduino doesn’t have a dedicated camera interface.
 Raspberry Pi can provide upto 8 GB of SDRAM enough to run multiple
functionalities and complex programs while arduino Uno has only 32 K bytes of
flash memory and 2 K bytes of SRAM.
 Raspberry Pi has its own OS and working with different languages including
Python (required in our case) is much easier as compared to Arduino

68
Fig 9.3: Screenshot of distance measurement done using Arduino Uno
o We are not able to detect symbols on number plates
o False interpretation of number plate quite a few times due to not good enough quality of
Camera module used.

Future scope:
o Can be used to identify stolen vehicles by mounting on highways
o Code can be improved for Number plates containing different symbols using CNN
techniques

o Two ultrasonic sensors can be used to decrease the chances of detection of objects other
than vehicles.

69
BIBLIOGRAPHY
Majorily we followed these two research papers from IRJET:

[1] Miss. Shraddha S. Ghadage, Mr. Sagar R. Khedkar “Automatic Number


Plate Recognition System Using Deep Learning Techniques” Walchand College
of Engineering, Sangli, Maharashtra Issue: 07 July 2020

[2] Prof. Kumthekar A.V., Ms. Sayali Owhal, Ms. Snehal Supekar, Ms.
Bhagyashri Tupe “ Recognition of vehicle number plate using Raspberry pi”
Department of E&TC, AGTI’s Dr. DACOE Karad, Maharashtra, India.

Other references include:

Setting Up Raspberry Pi:

https://www.youtube.com/watch?v=0hrF8Wq8SSQ

Ultrasonic Sensor:

https://www.electronicshub.org/raspberry-pi-ultrasonic-sensor-interface-
tutorial/

For sending Email from Pi:

www.iotdesignpro.com

Python and other software stuff:

https://youtube.com/c/HeatonResearch

https://youtube.com/codewithHarry

70
THANK YOU!

71

You might also like