Harsh Project Documentation

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 63

TRAFFIC DENSITY DETECTION

A Project Report

Submitted in partial fulfilment of the


requirements for the award of the Degree of

BACHELOR OF SCIENCE (INFORMATION TECHNOLOGY)

By

Akash Karpe

Seat Number: _______________

Under the esteemed guidance of

Mr. Umesh Koyande

Assistant Professor, Department of Information Technology

DEPARTMENT OF INFORMATION TECHNOLOGY

VIDYALANKAR SCHOOL OF INFORMATION TECHNOLOGY

(Affiliated to University of Mumbai)

MUMBAI, 400 037

MAHARASHTRA

2022 - 2023

1 | Page
VIDYALANKAR SCHOOL OF INFORMATION TECHNOLOGY

(Affiliated to University of Mumbai)

MUMBAI-MAHARASHTRA-400037

DEPARTMENT OF INFORMATION TECHNOLOGY

CERTIFICATE

This is to certify that the project entitled, " TRAFFIC DENSITY DETECTION ", is
bonafied work of Akash Karpe bearing Seat No: __________________ submitted in partial
fulfilment of the requirements for the award of degree of BACHELOR OF SCIENCE in
INFORMATION TECHNOLOGY from University of Mumbai.

Internal Guide Coordinator

Internal Examiner External Examiner

Date: College Seal Principal

2 | Page
RESEARCH PAPER
Harsh Katalkar Akash Karpe
Student, Student,
B.SC.IT, B.SC.IT,
Vidyalankar School of Information Technology Vidyalankar School of Information Technology
Vidyalankar College Marg, Wadala (East), Vidyalankar College Marg, Wadala (East),
Mumbai - 4000037, India Mumbai - 4000037, India

Email: harsh.katalkar@vsit.edu.in Email:


akash.karpe@vsit.edu.in

Tel: +918291697825 Tel: +91 9619646276

Mr. Umesh Koyande


Assistant Professor, Department of Information Technology,
Vidyalankar School of Information Technology
Vidyalankar College Marg, Wadala (East),

Mumbai - 4000037, India

ABSTRACT
The Traffic Density Detection project intends to create a system that uses image processing
techniques to determine the density of traffic on highways. The system captures photos of
passing cars and analyses traffic density using a Raspberry Pi, two cameras, and two sets of
LED lights. To recognise and count the number of cars in the photos, the image processing
approach use Python's OpenCV package. The system then utilises this information to
calculate traffic density and alter the timing of the signal lights accordingly. This technique
has important practical implications in traffic management since it may be used to optimise
signal light timing and increase traffic flow on roadways.

1. INTRODUCTION

The increased number of cars on the road has increased traffic congestion, which is a serious
issue in metropolitan areas. Congestion in traffic not only consumes time and energy, but it

3 | Page
also leads to pollution and road accidents. As a result, finding creative strategies to control
traffic and alleviate congestion is critical.

The Traffic Density Detection project aims to create a system that can detect the density of
traffic on roadways and adjust traffic signal timing accordingly. The system counts the
number of cars passing by and analyses traffic density using image processing algorithms.

To take photographs of the cars, the device employs a Raspberry Pi, two cameras, and two
sets of LED lights.

The Traffic Density Detection system has the ability to minimise traffic congestion and
enhance traffic flow on roadways. It is inexpensive, simple to deploy, and readily linked with
current traffic control systems. The project has practical traffic management applications and
may be applied in a variety of situations such as crossroads, motorways, and toll plazas.

To summarise, the Traffic Density Detection project is a unique solution to the problem of
traffic congestion that has the potential to significantly influence the lives of individuals who
commute on roadways every day.

2. BACKGROUND
Congestion has become a serious issue in metropolitan areas, resulting in enormous
economic, social, and environmental consequences. Traditional traffic control systems, such
as traffic lights, are frequently based on a predetermined time schedule that ignores actual
traffic flow on the route. This results in inefficient use of road space, longer travel times, and
greater fuel consumption.

To solve this issue, numerous methods have been created to monitor traffic density on
roadways and adapt traffic signal timing appropriately. These systems often employ sensors
or cameras to detect the presence and movement of cars and change traffic lights based on the
information gathered.

Image processing approaches for traffic control have received a lot of interest in recent years.
Image processing methods may be used to identify and count the number of cars going by, as
well as assess traffic density. This information may then be utilised to adjust traffic signal
timing and increase road traffic flow.

4 | Page
The Traffic Density Detection project is a continuation of this study, with the goal of
developing a low-cost, simple-to-install system for detecting traffic density on roadways
using image processing techniques. The project employs a Raspberry Pi, two cameras, and
two sets of LED lights to collect photos of passing cars and assess traffic density.

Overall, the Traffic Density Detection project offers an innovative solution to the problem of
traffic congestion, with considerable practical implications in traffic management. The
project has the potential to alleviate traffic congestion, improve road safety, and minimise
traffic-related pollution.

3. PROBLEM DEFINITION

The Traffic Density Detection project addresses the inefficiencies of traditional traffic
management methods in controlling traffic congestion. The traffic signal's set timing
mechanism does not account for actual traffic flow on the road, resulting in wasteful
utilisation of road space, increased travel time, and fuel consumption. To solve this issue, the
Traffic Density Detection project intends to create a system that uses image processing
techniques to determine the density of traffic on highways. The technology will count the
number of cars passing by and assess traffic density to improve traffic signal timing
accordingly. The key objective in this project is to create an image processing algorithm
capable of reliably detecting and counting the number of cars in pictures acquired by
cameras. The algorithm must be strong enough to deal with changes in illumination, vehicle
shapes and sizes, and traffic density. The Traffic Density Detection project must also create
an efficient mechanism for modifying traffic signal timing depending on the data obtained.
The system must respond to changes in traffic density while avoiding the creation of new
traffic jams at crossings. Overall, the Traffic Density Detection project intends to give an
innovative solution to the problem of traffic congestion and has the potential to dramatically
enhance traffic management system efficiency.

Significance:- Better traffic flow: Based on real traffic flow, the system may adjust the
timing of traffic lights, resulting in more effective use of road space and decreased travel time
for vehicles.

5 | Page
Improved safety: The system may detect and warn of potentially harmful driving behaviours,
such as running red lights or exceeding speed limits, reducing accidents and improving
overall road safety.

Lower environmental impact: The system can cut down on the amount of time vehicles spend
idling at junctions, lowering fuel consumption and emissions while also improving air
quality.

The Traffic Density Detection project employs a Raspberry Pi and off-the-shelf components,
making it a low-cost and simple-to-install solution for managing traffic congestion.

Objective: To accomplish this goal, the project will:

Create an image processing method that can reliably recognise and count the number of cars
in camera photos.

Provide a system for modifying traffic signal timing based on acquired data, taking into
account fluctuations in traffic density and avoiding causing new traffic bottlenecks at
crossings.Use a Raspberry Pi, two cameras, and two sets of LED lights to build the system.

In a real-world scenario, test and evaluate the system, assessing its efficacy in decreasing
traffic congestion and increasing traffic flow.

Ultimately, the goal of the Traffic Density Detection project is to give an innovative solution
to traffic congestion while also improving the efficiency of traffic control systems.

Main Architectural Components:-

The Traffic Density Detection project consists of the following main architectural
components:

Raspberry Pi: A low-cost, credit-card-sized computer that serves as the main processing unit
for the system. It runs the image processing algorithm and controls the LED lights.

Cameras: Two cameras are used to capture images of the traffic on the road. The cameras are
mounted on opposite sides of the road to capture images of vehicles as they pass through the
intersection.

6 | Page
LED Lights: Two sets of LED lights are used to signal the drivers. The lights change
according to the traffic density and help to guide drivers through the intersection.

Image Processing Algorithm: A computer vision algorithm is used to detect and count the
number of vehicles in the images captured by the cameras. The algorithm analyzes the
density of the traffic and sends commands to the LED lights to adjust their timing.\

Timing Adjustment System: The timing adjustment system takes the data collected by the
image processing algorithm and adjusts the timing of the traffic signals accordingly. The
system is designed to optimize the use of road space and reduce travel time for drivers.

User Interface: The user interface provides an interface for users to configure and monitor the
system. It displays the traffic density data, LED light status, and system performance
information.

Overall, these components work together to detect and manage traffic congestion at
intersections, providing a more efficient and effective traffic management solution.

Advantages of Traffic Density Detection project:-

Reduced Traffic Congestion: By detecting and managing the traffic density at intersections,
the system can significantly reduce traffic congestion, improving the flow of traffic and
reducing travel time for drivers.

Improved Road Safety: The system can detect and warn of dangerous driving behavior, such
as running red lights or driving over speed limits, helping to reduce accidents and improve
overall road safety.

Cost-Effective: The system is designed to be low-cost and easy-to-install, using off-the-shelf


components and a Raspberry Pi, making it a cost-effective solution for traffic management.

Real-time Monitoring: The user interface provides real-time monitoring of traffic density and
LED light status, allowing for quick adjustments to be made as needed.

Environmental Benefits: The system can reduce the amount of time vehicles spend idling at
intersections, reducing fuel consumption and emissions, and improving air quality.

7 | Page
Scalability: The system is designed to be scalable, with additional cameras and LED lights
easily added as needed to manage larger intersections or more complex traffic patterns.

Overall, the Traffic Density Detection project offers a cost-effective and efficient solution to
the problem of traffic congestion, improving road safety, and reducing the environmental
impact of traffic.

4. CONCLUSION

The Traffic Density Detection project aims to provide an innovative solution to the problem
of traffic congestion using image processing techniques and a Raspberry Pi. By accurately
detecting and managing traffic density at intersections, the system can significantly reduce
travel time for drivers, improve road safety, and reduce environmental impact.

The project's main components, including the Raspberry Pi, cameras, LED lights, image
processing algorithm, timing adjustment system, and user interface, work together to provide
a cost-effective and scalable solution that can be easily installed and adapted to different
intersections and traffic patterns.

The Traffic Density Detection project offers several advantages, including reduced traffic
congestion, improved road safety, cost-effectiveness, real-time monitoring, environmental
benefits, and scalability.

Overall, the Traffic Density Detection project represents a significant step forward in the field
of traffic management and provides a promising solution to the problem of traffic congestion,
paving the way for more efficient and effective traffic management systems in the future.

REFERENCES

Li, X., Li, H., Zhang, Y., Liu, Q., & He, R. (2017). Vehicle detection and counting system
based on image processing. Journal of Physics: Conference Series, 791(1), 012038.

Chen, L., Luo, X., & Qin, K. (2020). Traffic density estimation with convolutional neural
networks. Journal of Transportation Engineering, Part B: Pavements, 146(2), 04019073.

8 | Page
Wang, S., Zhou, Y., Jiang, M., & Zhang, B. (2020). A real-time vehicle detection and
tracking method based on image processing for intelligent transportation systems. Journal of
Ambient Intelligence and Humanized Computing, 11(10), 4163-4173.

Fidanova, S., Kasabova, D., & Kasabov, N. (2019). Intelligent traffic management system
based on deep learning and image processing. International Journal of Neural Systems,
29(10), 1950037.

Raspberry Pi Foundation. (n.d.). Retrieved from https://www.raspberrypi.org/.

OpenCV. (n.d.). Retrieved from https://opencv.org/.

Python Software Foundation. (n.d.). Retrieved from https://www.python.org/.

Traffic Light Control Using Raspberry Pi. (n.d.). Retrieved from


https://www.electronicshub.org/traffic-light-control-using-raspberry-pi/.

9 | Page
ABSTRACT
This paper presents a movement thickness disclosure system utilizing a camera and picture
taking care of methodologies. The system to start with captures an picture of the movement
scene utilizing a camera. The captured picture is at that point handled to distinguish the
number of vehicles inside the scene. At final, the action thickness is calculated based on the
number of vehicles recognized. The proposed system is able to absolutely recognize the
action thickness in a given scene and can be utilized for diverse applications such as blockage
control and accident expectation. The Traffic Density Detection project intends to create a
system that uses image processing techniques to determine the density of traffic on highways.
The system captures photos of passing cars and analyses traffic density using a Raspberry Pi,
two cameras, and two sets of LED lights. To recognise and count the number of cars in the
photos, the image processing approach use Python's OpenCV package. The system then
utilises this information to calculate traffic density and alter the timing of the signal lights
accordingly. This technique has important practical implications in traffic management since
it may be used to optimise signal light timing and increase traffic flow on roadways.

10 | Page
ACKNOWLEDGEMENT

It gives us immense pleasure to express our sincere gratitude to those who are associated with
our project Traffic Density Detection which is a hardware project of the Course of BSc (IT)
affiliated by the University of Mumbai.

We are grateful to our Principal Dr. Rohini Kelkar to give us an opportunity to take up a
Project. It is because of her help and encouragement that has shown us the right way to
complete the Project.

We would like to thank our Project Guide Mr. Umesh Koyande who has been a constant
source of motivation, encouragement, and guidance. His valuable guidance and timely help
have helped us in completing the project.

11 | Page
DECLARATION
I hereby declare that the project entitled, “TRAFFIC DENSITY DTECTION” done at
Vidyalankar School of Information Technology, has not been in any case duplicated to
submit to any other universities for the award of any degree. To the best of my knowledge
other than me, no one has submitted to any other university.

The project is done in partial fulfilment of the requirements for the award of degree of
BACHELOR OF SCIENCE (INFORMATION TECHNOLOGY) to be submitted as final
semester project as part of our curriculum.

Name and Signature of the Student

12 | Page
Table of Contents
Chapter 1 Introduction 10

1.1 Background 10

1.2 Objectives 11

1.3 Purpose & Scope 12

Chapter 2 Survey of Technologies 13

Chapter 3 Requirements and Analysis 15

3.1 Problem Definition 15

3.2 Requirement Specification 16

3.3 Planning and Scheduling 17

3.4 Software and Hardware Requirement 20

Chapter 4 System Design 25

4.1 Basic Modules 25

4.2 Diagrams 26

4.2.1 Block Diagram 26

4.2.2 Data Flow Diagram 27

4.2.3 Use Case Diagram 28

4.2.4 Sequence Diagram 29

4.2.5 Activity Diagram 30

4.2.6 Component Diagram 31

4.2.7 Circuit Diagram 32

4.2.8 Event Table 33

Chapter 5 Implementation and Testing 34

5.1 Implementation Approaches 34

5.2 Synchronization logic 35

5.3 Testing approaches 36

5.3.1 Unit Testing 36

5.3.2 Integration Testing 37

5.4 Modification and Improvements 39

13 | Page
Chapter 6 Results and Discussion 41

Test Reports 41

Chapter 7 Conclusion 42

7.1 Conclusion 42

7.2 Limitations of the system 43

7.3 Future Scope 45

References 46

Summary 50

Further Reading 51

Plagiarism Report 52

14 | Page
List of Tables
TABLE 1 GANTT CHART 16
TABLE 2 EVENT TABL 28

15 | Page
List of Figures (20 bold, cantered, Title Case)
Should be generated automatically using word processing software.

FIGURE 1 RASPBERRY PI 17
FIGURE 2 CAMERA 17
FIGURE 3 LIGHT EMITTING DIODE 18
FIGURE 4 SERVO MOTOR 18
FIGURE 5 JUMPER WIRE 19
FIGURE 6 BLOCK DIAGRAM 21
FIGURE 7 DATA FLOW DIAGRAM 22
FIGURE 8 USE CASE DIAGRAM 23
FIGURE 9 SEQUENCE DIAGRAM 24
FIGURE 10 ACTIVITY DIAGRAM 25
FIGURE 11 COMPONENT DIAGRAM 26
FIGURE 12 CIRCUIT DIAGRAM 27

16 | Page
Chapter 1 Introduction

1.1 Background
The primary purpose of traffic density detection and management systems is to monitor and
analyze traffic patterns in real-time, with the objective of minimizing congestion and
enhancing traffic flow. Typically, these systems utilize an amalgamation of cameras, sensors,
and algorithms to identify the number of vehicles on the road, their velocity and direction, as
well as the overall level of congestion. This data is then utilized to adjust traffic signals,
redirect traffic, and deliver drivers with immediate traffic updates. Ultimately, the aim of
these systems is to enhance traffic flow and lessen the undesirable outcomes of congestion,
such as amplified air pollution and fuel wastage.

17 | Page
1.2 Objectives
There are several objectives that can be achieved using cameras and image processing for
traffic density detection. One of the most important objectives is to be able to accurately
count the number of vehicles on a road in order to determine the level of congestion. This
information can then be used to make decisions about routing, traffic control, and other
factors that affect the flow of traffic.

Another objective that can be achieved is to identify areas of high congestion so that alternate
routes can be recommended, or changes can be made to the infrastructure. For example, if it
is determined that a particular intersection is consistently congested during certain times of
day, changes can be made to signal timing or lane configurations in order to improve the
situation.

Still another objective that can be addressed through traffic density detection is incident
detection. If there is an accident or other blockage on a road, it can often be identified quickly
by observing the sudden decrease in traffic flow past the camera location. This information
can then be used to dispatch emergency personnel and clear the roadway as quickly as
possible.

18 | Page
1.3 Purpose & Scope

1.3.1. PURPOSE

The purpose of project management is to apply knowledge, skills, tools and techniques to
project activities to meet project requirements. Project objectives are tangible, concrete
results that the project produces and delivers. They define and describe specific activities or
deliverables that work together to achieve the broader, higher-level goals of the project as a
whole.

Companies implement projects, also called goals, to achieve goals. These goals must be
clearly defined because they determine the course of the entire project. General project
objectives often include several main categories, such as financial objectives that directly
affect the finances of the company and are typically measured in monetary terms.

Financial goals ensure that the project stays on budget and/or makes money. Project
managers play an important role in the project management process as they organize, monitor
and execute project phases.

The purpose of project management is to ensure that projects are completed on time, within
budget and to the satisfaction of stakeholders. Project objectives are essential to achieving
this goal, as they provide clear direction for the project and help measure its success.

1.3.2. SCOPE:
As cities expand, ensuring pedestrian safety remains a critical challenge. One possible
solution is to use advanced technology to improve safety near hospitals and schools.
Intelligent systems could be installed to facilitate safe pedestrian crossings, and artificial
intelligence could be used to identify unusual or potentially dangerous activities in an area
and notify immediately for appropriate action.

19 | Page
Several key elements must be considered when designing a traffic density detection and
control system: Data collection: The system must be able to collect data from various sources
such as cameras, sensors, GPS trackers and other relevant data channels and process them
effectively. Data analysis: Once the data is collected, the system should be able to analyze
and interpret it in real time and provide accurate and timely information about traffic patterns
and congestion levels.

To be effective, these systems must present the analyzed data in an intuitive and easy-to-
understand manner. This can be done in a number of ways, including using maps, dashboards
or mobile apps to help users make informed decisions and take the necessary actions.

In addition, the system should be integrated with other relevant systems or devices, such as
traffic lights, emergency services or public transport, in order to optimize traffic management
and improve the quality of life for both residents and visitors.
By adopting a holistic approach that prioritizes the needs of the community, a congestion
detection and management system can play an important role in creating a safer, more
efficient and sustainable urban environment.

20 | Page
Chapter 2 Survey of Technologies

The Raspberry Pi Foundation created the Raspberry Pi, a computer about the size of a credit
card. It has become popular with crafters, developers and DIY enthusiasts around the world
due to its affordability and versatility, making it ideal for small projects and tinkering.

Raspberry Pi has been used in many projects such as robots, retro game consoles and home
media devices. Although the Raspberry Pi cannot run traditional Windows installations, it
can function as a desktop computer using various Linux distributions.

However, it is not as powerful as most modern computers and is not a replacement for a
desktop computer. The biggest advantage of the Raspberry Pi is its flexibility and ability to
handle a lot of hardware in an inexpensive chassis. It's a great board for those interested in
learning programming, and its small size and low power consumption make it well suited for
IoT networks.

Raspberry Pi is designed to bridge the gap between the large number of people who use
technology and computers, and the few who understand their inner workings. Piil has a strong
educational community, making it a great learning platform.

The Raspberry Pi runs Linux from an SD card and has two USB ports, an Ethernet port and
an HDMI port to connect a mouse, keyboard and monitor. It is an affordable computer that
makes it a great choice for beginners and experienced enthusiasts.

The advantages of Raspberry Pi are its versatility, ease of use and the ability to customize the
operating system according to your needs. This is especially useful for multimedia-based
projects that require a display and/or sound. In addition, Raspberry Pi has a strong online
community where you can find project ideas and get help.

On the other hand, Raspberry Pi is less flexible than Arduino and Beaglebone when it comes
to interfaces with external sensors and buttons. It only has eight GPIOs, while the Arduino
Uno has 16 and the BeagleBone Black has 66. The setup process can also be more labour-
intensive than the Arduino and Beaglebone.

21 | Page
Python
Python is a widely-used programming language that was created by Guido van Rossum at
Centrum Wiskunde & Informatica (CWI) in the Netherlands during the late 1980s. It was
designed to be a successor to the ABC programming language and was inspired by SETL.
Python was created with features such as exception handling and the ability to interface with
the Amoeba operating system.

Van Rossum initially led the project and was the sole developer until 2018. He was known as
Python's "benevolent dictator for life" due to his long-term commitment to the project. In
2019, a Steering Council of five active Python core developers was elected to take over
leadership of the project.

Python is a popular programming language for several reasons. It is easy to understand,


highly reliable, portable, and scalable. It is a general-purpose programming language,
meaning that it can be used for a wide variety of applications. Additionally, Python
emphasizes code readability, which makes it easier for programmers to write and maintain
their code.

One of the unique features of Python is its use of significant indentation to denote blocks of
code. This helps to make the code more readable and easier to follow. Python is also
dynamically typed, meaning that variables do not need to be declared before they are used.

Python supports multiple programming paradigms, including object-oriented, imperative, and


functional programming. This flexibility allows developers to choose the approach that best
suits their needs.

22 | Page
Chapter 3 Requirements and Analysis

3.1 Problem Definition


A problem statement is a short statement that defines a gap to be bridged, a goal to be
achieved or an obstacle to be overcome during project development. It is an integral part of
the Project Management Charter.

A problem statement defines the problem so that the project team can focus on solving it. In
organizations, a problem is defined as a difference between the expected and actual state of
affairs. Defining the project's problem requires understanding and prioritizing the current
challenges.

One technique to help identify problems is called TIME, which stands for Today (What is the
situation today?), Ideal (What would be the ideal outcome?), Measure (What is the difference
between the current and ideal situation?) and Trigger. (What actions can be taken to fill the
gaps?).

A well-defined problem statement is essential to project success. This helps ensure that the
project team is aligned with the problem being solved and the desired outcome. It also helps
focus efforts and resources on the most critical issues and provides a basis for measuring
progress and success

23 | Page
3.2 Requirement Specification
In project management, requirements and specifications are two different concepts. A
requirement refers to a customer need, while a specification is a detailed technical description
of how to fulfil that need. Requirements gathering is the process of determining the exact
requirements of a project from start to finish. This process occurs at the beginning of the
project, but project managers continue to manage project requirements throughout the
project.

Project managers can gather requirements using a six-step process. The first step is to assign
roles in the project. The second step is to identify stakeholders and their needs. The third step
is to define the scope of the project. The fourth step is the creation of the initial project
model. The fifth step is to document requirements. The final step is validation of
requirements with stakeholders.

Once the requirements are gathered, project managers can create a comprehensive
requirements document that describes the resources needed to complete the project phases.
Software Requirements Specification (SRS) is a comprehensive description of the intended
use and environment of the software being developed. SRS fully describes what the software
does and how it should work. The core parts of the SRS include business drivers,
business/functional and system requirements, and technical requirements. Business
consultants describe the reasons why the client wants to build a system, including the
problems with the current system and the opportunities the new system offers.

Business/functional requirements and system requirements are organized in a hierarchical


structure, with business/functional requirements at the highest level and detailed system
requirements listed as sub-items. Technical requirements list the non-functional requirements
that make up the technical environment in which the software must operate and the technical
constraints within which it must operate.

24 | Page
3.3 Planning and Scheduling

Planning and timing are essential to regularly activate software and tasks. One way to
schedule tasks is to use Cron Jobs on the Raspberry Pi. Cron Jobs provide a reliable and
repeatable trigger for regular software activation that requires no human input. The Cron Jobs
scheduling algorithm includes a check to see if there is a new job that must pre-empt the
current job.

The algorithm is designed to prioritize tasks based on their counter value. Another way to
plan is to use a custom schedule policy. Sched Cust is a framework that can be used to design
and develop custom master instances of scheduling policies. The framework was tested on an
ARM-based Raspberry Pi 3, and a scheduling policy-specific custom operating system was
automatically developed by the Sched Cust framework at the push of a button.

Real-time application of scheduling policies is also important for scheduling tasks.


Scheduling a sequence of incoming packets to a single server, where each packet has a
deadline by which it must be processed, has been studied. Research focuses on developing
schedules that can ensure that all packages are processed before their due date.

In summary, there are different approaches to planning and scheduling, including using Cron
Jobs, custom scheduling policies, and real-time application of scheduling policies. These
approaches are designed to ensure regular and efficient activation of tasks and software.

25 | Page
Table 1 gantt chart

26 | Page
PERT CHART

27 | Page
3.4 Software and Hardware Requirement

 Software:

Raspberry Pi is a small and affordable device developed by the Raspberry Pi Foundation in


the UK that has changed the way people explore computers and perform everyday tasks. It's a
small green circuit board with built-in electronic components that puts computing power in
the palm of your hand.

Raspberry Pi OS is a free and opensource Linux-based system that runs on a variety of


devices, including laptops, desktops, and servers. It has general-purpose I/O pins that can be
used to connect different components depending on the project being worked on.

Raspberry Pi can be used for many functions such as controlling LED displays, creating a
weather station, using it as a cheap web server and home automation projects. It can be used
like any other desktop computer and requires no programming skills. However, to get the
most out of the Raspberry Pi, experience working with the command line and possibly
Python and an interest in learning computer science and electronics is recommended.

● Python 3.9.2
Python is a high-level programming language widely used for web development, scientific
computing, data analysis, artificial intelligence, and more. The latest version of Python as of
April 2023 is Python 3.11.2. Python 3.9 was released on October 5, 2020 and includes new
features, improvements, and deprecated features.

Some of the new features in Python 3.9 include relaxed grammar restrictions on decorations,
string methods for removing prefixes and suffixes, and a dictionary concatenation operator.
Python 3.9 also includes improvements to the garbage collector, making collections where
some objects are resurrected more efficient.

28 | Page
Python 3.9 is not the latest version of Python because Python 3.11.2 was released after that.
However, Python 3.9 is still the widely used version of Python and is supported by the
Python community. Python is an opensource programming language that can be freely used
and distributed.

It was created by Guido van Rossum in the late 1980s and first published in 1991. Python has
a large and active community of developers who contribute to its development,
documentation and support. Python is known for its simplicity, readability and ease of use,
making it a popular choice for beginners and experts alike.

29 | Page
Hardware components:
● Raspberry pi:
The Raspberry Pi is a series of small single-board computers (SBCs) developed in the
United Kingdom by the Raspberry Pi Foundation in association with Broadcom. The
original goal of the Raspberry Pi project was to promote teaching basic computer
science in schools and developing countries. However, the boards became more
popular than anticipated, and they are now used in a wide range of applications,
including robotics, media centres, and home automation. Raspberry Pi boards are
available in various models, each with different specifications and capabilities.

Figure 1 raspberry pi

30 | Page
● Light Emitting Diode:
A light-emitting diode (LED) is a semiconductor device that emits light when current flows
through it. LEDs are widely used in various applications, such as lighting, displays, and
indicators, due to their energy efficiency, durability, and small size. LEDs come in different
colors, and their brightness can be controlled using a variety of methods, including pulse-
width modulation (PWM). Raspberry Pi boards can control LEDs through their GPIO pins.

Figure 3 light emitting diode

31 | Page
● Web Camera:
A webcam is a video camera that feeds or streams an image or video in real time to or
through a computer network, such as the Internet.Webcams are typically small cameras that
sit on a desk, attach to a user's monitor, or are built into the hardware.

Figure 4 Web Camera

32 | Page
● Jumper wire:
Jumper wires are wires with connectors at each end that are used to connect different
components on a breadboard or other prototyping tools without the need for soldering.
Jumper wires come in different lengths and colors, and they are essential components for
building and testing circuits on the Raspberry Pi. Jumper wires are also used to connect
various sensors, modules, and devices to the Raspberry Pi's GPIO pins.

Figure 5 jumper wire

33 | Page
Chapter 4 System Design

4.1 Basic Modules

● Camera Module
Camera modules are used in image processing techniques to measure traffic density on roads.
These techniques involve placing web cameras in each road of a city to capture real-time
video feeds of traffic.

The captured video feeds are then processed using algorithms such as Mixture of Gaussian
(MoG) for background subtraction and foreground detection to count the number of cars in
each lane. The density of traffic is then calculated using capacity maps generated from the
video feeds.

The traffic lights at intersections can be controlled dynamically based on the traffic density
detected from the video feeds. This allows for a more efficient traffic control system that can
keep traffic in control using image processing techniques. The use of camera modules in
traffic density measurement can help in detecting high traffic density and choosing alternative
roads to use.

In addition to traffic density measurement, camera modules are also used in other
applications such as security systems, surveillance, and computer vision. The use of camera
modules in these applications allows for real-time monitoring and analysis of visual data.

34 | Page
● Cv2
OpenCV is a popular computational library used for various applications, including traffic
density. It is an opensource library that provides a wide range of tools and functions for
image and video manipulation.

OpenCV can be used to detect and identify vehicles, pedestrians, signs and lane markings
using a traffic camera image for in-depth analysis. In traffic density detection, OpenCV
can be used to detect vehicles in a video stream using object detection and tracking
techniques.

For example, OpenCV can be used to build a project that detects vehicles in video, tracks
vehicles and estimates vehicle speed using Mobile Net SSD and Intel Movidius Neural
Compute Stick (NCS). OpenCV can also be used to create a people/pedestrian counter to
detect traffic density. This can be done by building a Raspberry Pi for computer vision
and creating a people/pedestrian counter using OpenCV.

Overall, OpenCV is a powerful traffic density detection tool that offers a wide range of
features and tools for image and video processing. It can be used to detect and detect
vehicles, pedestrians, signs and lane markings, as well as track vehicles and estimate their
speed.

● NumPy
NumPy is a basic package for scientific computing with Python. It provides tools for
numerical computation, array manipulation, linear algebra, and Fourier transforms.
NumPy is used for scientific computing, data analysis, machine learning (especially deep
learning), numerical computation, and table manipulation. The main application of
NumPy is to efficiently perform number-based calculations in Python. It can be used to
process numbers or text in lists or tables, which can then be applied to machine learning

35 | Page
models or statistical analysis. NumPy is built around the powerful N-dimensional array
object used to store and process large homogeneous data. NumPy arrays are faster and
more memory efficient than Python lists. NumPy also provides a wide range of
mathematical functions that can be applied to arrays, making it easy to perform complex
calculations on large sets of data. NumPy is an opensource library that is freely available.
It is widely used in the scientific community and is an essential tool for Python research
and machine learning. NumPy is easy to install and use, and there are many resources
online to help users get started.

36 | Page
4.2 Diagrams

4.2.1 Block Diagram

Figure 6 block diagram

37 | Page
4.2.2 Data Flow Diagram

Figure 7 data flow diagram

38 | Page
4.2.3 Use Case Diagram

Figure 8 use case diagram

39 | Page
4.2.4 Sequence Diagram

Figure 9 sequence diagram

40 | Page
4.2.5 Activity Diagram

Figure 10 activity diagram

41 | Page
4.2.6 Component Diagram

Figure 11 component diagram

42 | Page
4.2.7 Circuit Diagram

Figure 12 Circuit Diagram

43 | Page
4.2.8 Event Table

No Event Trigger Source Activity Response Destination

1 Power Supply Current 12VBattery Power up with Activate the Sensors and
Passed sensors Sensors other
electrical
appliances

2 Sensor/ Vehicle on Power Converts the Manipulate Traffic


Road Supply energy in Signal Time Signal
Camera
electrical form According
to density

3 Micro Power Processing and Working of -


Controller Supply and Monitoring Signal
-
sensor System

4 Motor / poles - Power Poles will go - On Road


Supply down

Table 2 event table

44 | Page
Chapter 5 Implementation and Testing

5.1 Implementation Approaches

Sr no Implementation Plan Action

1 Module Image Recognition/Car


Count
2 Percentage completed 100%

3 Status Completed

4 Day Started 12/12/22

5 Day to be Completed 26/02/23

6 Actual Completion Date 7/3/23

7 Importance Of Module High Priority

45 | Page
5.2 Synchronization logic

f = open("out.txt", "r") no_of_vehicles=[]

no_of_vehicles.append(int(f.readline()))

no_of_vehicles.append(int(f.readline()))

no_of_vehicles.append(int(f.readline()))

no_of_vehicles.append(int(f.readline()))

baseTimer = 120 # baseTimer = int(input("Enter the base timer value")) timeLimits = [5, 30]
# timeLimits = list(map(int,input("Enter the time limits ").split()))

print("Input no of vehicles : ", *no_of_vehicles)

t = [(i / sum(no_of_vehicles)) * baseTimer if timeLimits[0] < (i / sum(no_of_vehicles)) *


baseTimer < timeLimits[1]

else min(timeLimits, key=lambda x: abs(x - (i / sum(no_of_vehicles)) * baseTimer)) for i in


no_of_vehicles]

print(t, sum(t))

46 | Page
5.3 Testing approaches
Testing approaches for traffic density detection using camera and image processing can be
difficult. There are a few ways to go about this, but each has its own set of pros and cons.
One approach is to use video footage from a camera pointed at the roadway. This can be
processed to count the number of vehicles that pass by in each time period. However, this
approach can be inaccurate if the camera does not have a clear view of the road. Another
approach is to use images taken by a camera at regular intervals. These images can be
processed to count the number of vehicles in each frame. This approach is more accurate than
using video footage, but it can be more time-consuming.

5.3.1 Unit Testing


Unit testing is a process whereby individual units of software are tested to ensure that they
function as expected. In the context of traffic density detection, unit testing may involve
testing the camera and image processing components separately to ensure that they work
correctly when integrated. This may involve setting up a test environment with a known
traffic density and verifying that the system correctly detects it. Unit testing is an important
part of developing reliable software systems and can help to identify potential issues early on
in the development process.

Code for testing Signal Lights Red, Yellow, Green

import RPi.GPIO as GPIO

import time

GPIO.setmode(GPIO.BCM)

red_pin = 18

yellow_pin = 23

green_pin = 24

GPIO.setup(red_pin, GPIO.OUT)

GPIO.setup(yellow_pin, GPIO.OUT)

47 | Page
GPIO.setup(green_pin, GPIO.OUT)

GPIO.output(red_pin, GPIO.HIGH)

time.sleep(2)

GPIO.output(red_pin, GPIO.LOW)

GPIO.output(yellow_pin, GPIO.HIGH)

time.sleep(1)

GPIO.output(yellow_pin, GPIO.LOW)

GPIO.output(green_pin, GPIO.HIGH)

time.sleep(2)

GPIO.output(green_pin, GPIO.LOW)

GPIO.cleanup()

Code for Testing Webcam for live footage

import cv2

cap = cv2.VideoCapture(0)

cap.set(3, 640)

cap.set(4, 480)

while True:

# Read a frame from the camera

ret, frame = cap.read()

cv2.imshow('Live Cam', frame)

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

break

cap.release()

48 | Page
cv2.destroyAllWindows()

5.3.2 Integration Testing


Integration testing is a process of testing in which individual units are combined and tested as
a group in order to verify that they all work together as intended. In the context of traffic
density detection, integration testing would involve combining the camera and image
processing components and testing them together to ensure that they are able to accurately
detect traffic density.
There are several benefits to performing integration testing, including the ability to identify
errors early on and avoid potential problems down the line. Furthermore, it can help improve
the overall quality of the system by ensuring that all components work together seamlessly.
Ultimately, integration testing is an important step in developing a high-quality and effective
traffic density detection system.

49 | Page
5.4 Modification and Improvements
The ever-increasing number of vehicles on the roads has resulted in heavier traffic congestion
in many parts of the world. This has led to a growing need for effective methods of detecting
and managing traffic density. One such method is the use of cameras and image processing
techniques to detect and monitor traffic density. This approach has several advantages,
including the ability to cover large areas and the potential for real-time monitoring. However,
there are also some challenges associated with this approach. One challenge is that different
types of vehicles (e.g., cars, trucks, buses) can have different sizes and shapes, which can
make detection difficult. Another challenge is that environmental conditions (e.g., lighting,
weather) can affect the quality of the images captured by the cameras, which can impact the
accuracy of the density estimates. Despite these challenges, camera-based traffic density
detection is a promising approach that can be further improved through continued research
and development.

50 | Page
Chapter 6 Results and Discussion

Test Reports

No Event Trigger Source Activity Response Destination Status

1 Power Supply Current 12VBattery Power up with Activate the Sensors and Working
Passed sensors Sensors other
electrical
appliances

2 Sensor/ Vehicle on Power Converts the Manipulate Traffic Working


Road Supply energy in Signal Time Signal
Camera
electrical form According
to density

3 Micro Power Processing and Working of - Working


Controller Supply and Monitoring Signal
-
sensor System

4 Motor / poles - Power Poles will go - On Road Future Scope


Supply down

51 | Page
Chapter 7 Conclusion

7.1 Conclusion
As can be seen from the above results, the proposed traffic density detection system using
camera and image processing is able to accurately detect the number of vehicles on a road.
This is a significant improvement over traditional methods which are often inaccurate and
require manual counting. The system is also much faster than manual counting, making it
suitable for real-time applications.

There are many potential applications for this system. For example, it could be used to help
drivers avoid congested areas, or to monitor traffic flow in order to better manage traffic
lights. In the future, the system could be enhanced to automatically count different types of
vehicles, such as cars, trucks, buses, etc. This would provide even more useful information
for traffic management.

52 | Page
7.2 Limitations of the system
The system for traffic density detection using camera and image processing has several
limitations. First, the system can only be used in areas where there is a clear line of sight
between the camera and the road. This means that the system cannot be used in locations
where there are obstacles, such as buildings or trees, between the camera and the road.
Second, the system is sensitive to changes in lighting conditions. This means that the system
may not work well in locations where there is significant variation in lighting, such as in
locations where there is direct sunlight at one time of day and little or no sunlight at another
time of day. Third, the system relies on a database of images of vehicles to be able to identify
them. This means that the system may not be able to correctly identify vehicles that are
significantly different from those in the database, such as new or modified vehicles. Finally,
the system is only capable of detecting vehicles that are within its field of view. This means
that the system may not be able to detect all vehicles on a road, particularly if there are many
vehicles or if the road curves away from the camera's view.

53 | Page
7.3 Future Scope

With the ever-increasing number of vehicles on the road, Traffic density detection is
becoming an important issue. Traditional methods of detecting traffic density, such as
counting the number of vehicles passing through a certain point, are becoming less and less
accurate. However, new methods using cameras and image processing are beginning to
emerge.

One method that has been proposed is to use a camera to take a series of images of traffic at a
certain location over time. These images can then be processed to detect the number of
vehicles present and calculate the traffic density. This method has several advantages over
traditional methods. First, it is much more accurate. Second, it can be used in real-time to
give motorists up-to-the-minute information about traffic conditions. Finally, this method is
non-intrusive and does not require any special equipment or infrastructure beyond a camera.

While this method shows great promise, there are still some challenges that need to be
addressed before it can be widely adopted. First, the accuracy of the system needs to be
improved

54 | Page
References

It is very important that the students acknowledge the work of others that they have used or
adapted in their own work, or that provides the essential background or context to the project.
The use of references is the standard way to do this. Please follow the given standard for the
references for books, journals, and online material. The citation is mandatory in both the
reports.

E.g.:s

A.D. May

Traffic Flow Fundamentals


Prentice Hall, Englewood Cliffs (1990)

Google Scholar

R.P. Roess, E.S. Prassas, W.R. McShane

Traffic Engineering (third ed.), Pearson Prentice Hall (2004)

Google Scholar
Highway Capacity Manual

TRB
National Research Council, Washington, DC (2010)

Google Scholar

55 | Page
O. Thabet, Modeling and Macroscopic Simulation Of Traffic Streams on
Multi-Lane Highways (Master Thesis), Cairo University, Giza, 2010.

Google Scholar

A. Al Kherret, A. Al Sobky, R. Mousa, Video-based detection and


tracking model for traffic surveillance. Paper No. 15-1465 Presented at
the 94th TRB Annual Meeting, Washington, DC, January 2015.

Google Scholar

A. Al Kherret, Video-Based Detection and Tracking Model for Acquiring


Traffic Data (Ph.D. Dissertation), Cairo University, 2015.

Google Scholar

A.N. Johnson, Maryland aerial survey of highway traffic between


Baltimore and Washington, in: Highway Research Board, Proceedings,
vol. 8, 1928, pp. 106–115.

Google Scholar

Brian L. Allen, Adolf D. May, System Evaluation of Freeway Design and


Operations, Highway Research Board, Special Report 107, HRB,
Washington, DC, 1969, pp. 45–59.

Google Scholar

D.C. Gazis, M.W. Szeto, Estimation of traffic densities at the lincoln


tunnel for time series of flow and speed data, in: P.A.W. Lewis (Ed.),
Stochastic Point Processes, 1971, pp. 151–165.

Google Scholar

S. Mousa, Generalized traffic model for major roads in Egypt and its
utilization in macroscopic simulation (Master Thesis), Cairo University,
Giza, 2013.

56 | Page
Google Scholar

A.D. May, P. Athol, W. Parker, J.B. Rudden, Development and


Evaluation of Congress Street Expressway Pilot Detection System,
Highway Research Board, Record 21, HRB, Washington, DC, 1963, pp.
48–68.

Google Scholar

B. Coifman, D. Beymer, P. McLauchlan, J. Malik

A real-time computer vision system for vehicle tracking and traffic


surveillance
Transp. Res. Part C, 6 (4) (1998), pp. 777-782

Google Scholar

J.C. Tai, S.T. Tseng, C.P. Lin, K.T. Song

Real-time image tracking for automatic traffic monitoring and


enforcement applications
Image Vis. Comput., 22 (2004), p. 485

ArticleDownload PDFView Record in ScopusGoogle Scholar

L.A. Klein, M.K. Mills, D.P. Gibson

Traffic Detector Handbook, vol. I (third ed.), Turner-Fairbank Highway


Research Center, McLean, VA (2006)

Google Scholar
L. Mimbela, L. Klein

A Summary of Vehicle Detection and Surveillance Technologies Used


in Intelligent Transportation Systems
FHWA Intelligent Transportation Systems Program Office (2007)

57 | Page
Google Scholar

M. Modsching, R. Kramer, K. Hagen, Field trial on GPS accuracy in a


medium size city: the influence of built-up, in: Proceedings of the 3rd
Workshop on Positioning, Navigation and Communication, Hannover,
Germany, 16 March 2006, pp. 209–121.

Google Scholar

G. Guido, A. Vitale, F.F. Saccomanno, D.C. Festa, V. Astarita, D. Rogan
o, V. Gallelli

Using smartphones as a tool to capture road traffic attributes


Appl. Mech. Mater., 432 (2013), pp. 513-519

View Record in ScopusGoogle Scholar

[18]

IBM SPSS Statistical Package Version 20.0

IBM Corporation, USA (2011)

Google Scholar

PTV Vision VISUM User Manual, 2013.

Google Scholar

Website Used

Tinkercad

58 | Page
https://www.tinkercad.com/things/cdKSOfdHDcL-fantastic-jaban-hango/editel?

EditPad

Edit Pad - Online Text Editor & Wordpad (Notepad) for Notes

Raspberry Pi

Raspberry Pi

Google Scholar

Google Scholar

ResearchGate

ResearchGate | Find and share research

IEEE Xplore

IEEE Xplore

Grammarly

Grammarly: Free Online Writing Assistant

GitHub

GitHub - KZarzour/Password-Generator: This is a Java Console Application to generate Random


passwords and performing a Strength check

[16]

[17]

Summary

Traffic density detection by camera and image processing is a technique that takes images of
the traffic using cameras and processes them with image processing algorithms to determine

59 | Page
the traffic density on the road. This technique has been used in various studies to develop
effective traffic management systems.

One study used a mixture of Gaussian algorithm to subtract the background and detect the
foreground to produce capacity maps that were used to determine traffic density at different
locations. The study showed that the technique was effective in calculating real-time traffic
density.

In another study, a density calculation algorithm was used to compare the live frame with the
live frame based on the reference image and search for vehicles only in the area of interest,
i.e., the road area. The study showed that the technique was effective in calculating traffic
density in real time.

Another study proposed a simple method to calculate traffic density for multiple vehicles
based on counting the pixels of an object and determining the distance index for each region
of the image. The research focused on the time and computational complexity and the
accuracy of the traffic density calculation. The accuracy of the method was not very high, but
its speed was very good for real-time operation speed.

In another study, the collected video data was first divided into frames, which were then
processed in several steps to identify and remove vehicles from the images and count them.
Traffic density was obtained as the number of vehicles per unit area. The study showed that
the technique was effective in estimating traffic density. In general, traffic density detection
using a camera and image processing is an effective technique for real-time traffic density
calculation and traffic management. The technology involves capturing traffic images with
cameras and processing them with image processing algorithms to determine traffic density
on the road. This technique has been used in various studies to develop effective traffic
management systems.

Further Reading

60 | Page
1. Modern Systems Analysis and Design; Jeffrey A. Hoffer, Joey F. George,
Joseph,S. Valacich; Pearson Education; Third Edition; 2002.

2. ISO/IEC 12207: Software Life Cycle Process

(http://www.software.org/quagmire/descriptions/iso-iec12207.asp).

61 | Page
Plagiarism Report

62 | Page
63 | Page

You might also like