You are on page 1of 5

2020 IEEE Students’ Conference on Engineering & Systems (SCES)

July 10-12, 2020


Prayagraj, India

Real-time video monitoring of vehicular


traffic and adaptive signal change using
Raspberry Pi
Ayushi Gupta1, Dr.Charu Gandhi2, Vartika Katara3, Stuti Brar4
1 , 2, 3, 4
CSE Deptt., Jaypee Institute of Information Technology, Noida, India
E-mail: ayushigupta8@gmail.com, charu.gandhi@jiit.ac.in, vartika2198@gmail.com,
and brarstutii@gmail.com

Abstract—Traffic congestion is a major predicament these days. detection. Section III provides a system overview of the
Even though it pervades all over, urban cities are the ones most hardware used. Section IV presents the proposed method;
affected by it which leads to major wastage of time on traffic Section V summarizes the experimental settings along with the
junctions. While insufficient road capacity and ever-increasing experimental results and analysis. Finally, Section VI
demand are somewhat interdependent, the delay of respective concludes the paper with remarks.
traffic lights is hardcoded and not reliant on traffic intensity.
Therefore, the need for simulating and optimizing traffic control II. LITERATURE REVIEW
in real-time to better accommodate this increasing demand Numerous works have been done previously on traffic
arises.This paper presents a method to use live video feed from monitoring and vehicle detection.
the cameras at traffic junctions for real-time traffic density
estimation. It also focuses on providing an effective traffic light V. E. Dahiphale and S. R. Rao [1], presented a real-time
switch timer according to the vehicle density, thereby aiming at computer vision system for monitoring driver vigilance for the
reducing the traffic congestion on roads. prevention of accidents. They used a video camera and a
hardware system controlling the alarm system through
Index Terms--Image contouring, Image processing, Raspberry Pi [9]. However, the system focused on driver
Raspberry Pi, Real-time video, Traffic management. vigilance monitoring and paid no attention to the road traffic
density and time wasted waiting at traffic signals.
I. INTRODUCTION
T. Tangkocharoen and A. Srisuphab[2], work detected the
In current times, road transportation is the crudest mode of vehicles using image processing techniques. They used the
transport in all parts of the world. The vehicle density on roads AdaBoost ensemble method with a cascade classifier for
is increasing epidemically on a day to day basis Due to this, experimental modeling. They performed vehicle detection using
traffic congestion in major cities has become indispensable. Haar-like object detectors. These detectors have a very low
Furthermore, inefficient traffic management of traffic causes processing power and a highly precise image of the vehicles is
wastage of valuable time and fuel, Its adverse effects include needed. To get these high precision images, they fixed their
ease in air pollution, cost of transportation, and stress levels of camera position. However, there is a certain limit to the types of
the drivers. So, it is very much necessary to design a system to things it can detect. If it is given edge and line features, then it
avoid the above casualties thus, preventing accidents, will only be able to detect objects with clear edges and lines.
collisions, and traffic jams. Using real-time analytics of data Thus, proving inefficient in case of low-quality camera video
from the video sources like cameras on traffic signals and capture.
linking them to some trends, we can manage traffic flow much
better. TasnimSorwar, Sabbir Bin Azad, Sayed Rizban Hussain and
Azfar Isa Mahmood [3] have used the method of image
The traditional traffic signaling systems suffered from the capturing using raspberry pi upon which image processing is
problem of inefficient time management since the signal done. They have initially done grayscale conversion followed by
appeared green even if there is no passer-by. Image processing histogram equalization and morphological opening and closing.
has aided in removing such a problem [4]. The proposed The irrelevant part of the road is cropped and the area having
technique suggests a solution for reducing traffic congestion on different vehicles is separated after which images are labeled
roads. It aims to replace the older system, where traffic lights and counting is done to identify the count of vehicles with
were hardcoded leading to unwanted delays at the signals. By respect to a threshold. Their model worked well on big vehicles
adapting the traffic signal timers to the vehicle density at a in a high-resolution image. The limitation of their project was
given time, pause time at the signal can be reduced that it couldn’t identify smaller and three-wheel vehicles.
significantly. Reduction in waiting time at the traffic signal will
lessen the number of accidents and also reduce fuel Gadekar et.al, [4] used the method of blob analysis and
consumption. This shall in turn help in controlling the air background subtraction with template matching to identify
pollution. vehicles. Even though this method proved efficient and faster
than earlier methods, one major drawback can be a clear
This paper is structured as follows: Section II presents a background foreground relation requirement.
detailed review of literature on traffic monitoring and vehicle

978-1-7281-9339-7/20/$31.00 ©2020 IEEE

Authorized licensed use limited to: UNIVERSITY OF WESTERN ONTARIO. Downloaded on December 20,2020 at 17:39:25 UTC from IEEE Xplore. Restrictions apply.
A background subtraction algorithm [5] was also proposed
for vehicular detection and centroid of the bounding boxes of
the detected object, to track the objects. However, their primary
research focused only on the detection and tracking of objects
and maintaining a vehicular count in a monitored region.
A selection process for the interest region was proposed [6]
which were then applied to the image sequences, focusing on
segmentation by multiplying a mask image with the original
image. Then, morphological processing was done on the
segmented region, which is followed by contouring to
determine road occupancy and traffic signal color. The major
drawback was obtaining processed image sequences with
strong light intensity variations. In real-time, these are Figure 1. The Architecture of the Project
accommodated at a 10-minute interval, thus proving inefficient
in case of varied image sequences.
A method using [7] vehicle detection, tracking, and IV. PROPOSED METHOD
counting for highway videos has also been proposed. Here In this project, we have proposed a model combining Object
vehicles were detected using background subtraction, contour Contouring [5] [8] [9] and Object Centroid Identification [10],
detection, and optimized by using morphological operations. to identify the moving vehicles accurately.
Distance similarity measurement was used for vehicle tracking.
However, due to the detected vehicle’s video dataset not being Two video footage were captured for testing purposes, one
static in one particular frame, the overall accuracy of vehicle during day time and the other in evening hours to capture
detection got affected. various traffic densities and natural light settings. It was
captured from a foot-over bridge located over a one-way road
III. SYSTEM MODEL where vehicles of various sizes were crossing. Table 3 mentions
The proposed work calculates the number of vehicles in a the vehicular count calculated by the proposed method v/s the
one-way lane covering a limited range. Raspberry Pi Camera actual vehicle count, calculated manually. These methods, when
Module is used for capturing the video of the vehicles. The combined, accurately identify a moving object, thus aiding in
system uses an RPi 3 Model B+. The specifications of the same calculating the vehicular density.
are mentioned in Table I.
The steps involved in the proposed method have been
TABLE I. RASPBERRY PI SPECIFICATIONS
diagrammatically represented in Figure 2.

Processor Quad-Core 1.4GHz Broadcom


BCM2837 64bit CPU

RAM 1 GB

GPIO 40-pin extended

USB Ports 4 USB-2

Port CSI camera port to connect to a


Raspberry Pi

Power Source Upgraded Micro USB power source up


to 2.5A

LAN and BCM43438 wireless LAN and


Bluetooth Bluetooth Low Energy (BLE) on board

Operating Raspbian Stretch OS


System

The pi is also connected to a breadboard which has LEDs Figure 2. Proposed Methodology
connected to indicate the working of a traffic light. Figure 1
depicts the created hardware architecture. Step 1: Lines are drawn over the video footage to get the
frame area for vehicle counting. Then, an OpenCV function
createBackgroundSubtractorMOG() is used to perform
background subtraction. This function is used for video

Authorized licensed use limited to: UNIVERSITY OF WESTERN ONTARIO. Downloaded on December 20,2020 at 17:39:25 UTC from IEEE Xplore. Restrictions apply.
background subtraction where it subtracts the moving object Step 4: Morphological opening is followed by
from the static background. Figure 3 shows the result. Morphological Closing i.e. erosion performed after dilation to
join the white region. Figure 6 shows the same.
Step 2: Binary thresholding is performed to remove the
shadows from the footage. This method reduces the frame pixel Step 5: Using the findContours() method of cv2 library,
value to only two, thus reducing the computing power required. contours are grabbed which identify only the moving vehicles;
Figure 4 depicts the same. the object coordinates calculated with respect to their movement
and position in the video capture. Once the contour has been
Step 3: Morphological Opening is performed i.e. erosion identified, a rectangle is drawn around the object and its
followed by dilation to remove noise, as depicted in Figure 5. centroid is identified, which helps in uniquely identifying the
moving object, irrespective of its shape.

Figure 3. Background subtraction


Figure 6. Morphological Closing

As the vehicles move through the Entry and Exit lines drawn
initially, a counter increases which shows the total contours
frame-wise. Along with that, a total count of the vehicles going
up and down the road is also displayed. The result is depicted in
Figure 7.

Figure 4. Binary thresholding

Figure 7. Contouring

Step 6: These contours control the traffic light change timer


which is calculated as follows:
For a 75m region, taking average vehicle length as 4m [11]
we identified that to declare the region as congested, it should
Figure 5. Morphological Opening have the number of vehicular count as greater than or equal to

Authorized licensed use limited to: UNIVERSITY OF WESTERN ONTARIO. Downloaded on December 20,2020 at 17:39:25 UTC from IEEE Xplore. Restrictions apply.
19. Thus, for varying vehicle count, the traffic light timers are TABLE IV. COMPARATIVE ANALYSIS OF RESULTS
proposed as in Table II.
Paper Accuracy
V. EXPERIMENTAL RESULT
Tangkocharoen et al [2] 95%
Table III presents the vehicular count calculated by the
proposed model v/s vehicular count calculated manually. From Sorwar et al [3] 91.08%
the experimental result as presented, the calculated accuracy of
the method for real-time vehicle detection and tracking, and Kulkarni et al [5] 97.39%
traffic signal timings is 95.65% which makes it more accurate
than the existing models. E. Ospina et al [6] 95%

TABLE II. PROPOSED SIGNAL TIMINGS WITH RESPECT M. Soleh et al [7] 93%
TO TRAFFIC DENSITY
M. F Chowdhary et al [8] 95.12%
Vehicle contour count Traffic light indicator
Proposed Method 95.65%
<=5 Red light for 90s

5<count<=10 Green light for 20s Kulkarni et al show an accuracy of 97.39% which is greater
than the proposed method’s accuracy. However, a major point
10<count<=15 Green light for 30s of contrast is that in [5], they are only focusing on improving
vehicle detection and tracking, whereas in the proposed
15<count<17 Green light for 60s method, the accuracy is calculated for vehicle detection and
tracking, as well as traffic signal timer.
count>=17 Green light for 90s
VI. CONCLUSION AND FUTURE WORK
With the advancement of rising innovation, modern and
TABLE III. CALCULATED V/S ACTUAL VEHICLE COUNT instructive improvement there are more open doors for work
and a better extent of training just as examination in creating
Count of Vehicles urban communities. The way of life of individuals in metro
urban areas with huge volumes of the populace is similarly
Calculated Actual
influenced by different applications and administration
4 3
frameworks. In this way, as of now, a large portion of the
urban areas are changing into savvy urban areas by receiving
5 4 mechanized frameworks in every single imaginable division.
This proposed framework lessens the chance of congested
6 6 driving conditions, brought about by high red light deferrals, to
a degree and effectively. Here we have planned the framework
4 4 with the reason to clear the traffic as per the vehicular density.
2 2 Reducing congestion and waiting time will lessen the
number of accidents and also reduces fuel consumption which
1 1 in turn will help in controlling air pollution. Moreover, the
apprehension of our project can be enhanced for Coordination
7 6 Control which places traffic signals on a coordinated system so
that drivers encounter long strings of green lights. This will
3 3 also provide data for where improvements and information on
roads or construction are required and which are urgent like
1 1
which junction has higher waiting times.
6 7 In the future, some enhancements can be done on the
proposed method. The proposed method can be extended to
7 6 two-lane roads and four-point junctions. Image processing
techniques can be used for identifying emergency vehicles.
3 3
Apart from this, vehicle number plate identification systems
5 6
can be inbuilt into the system to identify rule violating
vehicles. The proposed model can be improved by adding edge
Total: 66 63 detection to identify accident-prone areas and vehicles. The
signal timer algorithm also lies in the future scope of this
project.
A comparative analysis with the existing models is shown
in Table IV.

Authorized licensed use limited to: UNIVERSITY OF WESTERN ONTARIO. Downloaded on December 20,2020 at 17:39:25 UTC from IEEE Xplore. Restrictions apply.
REFERENCES
[1] V. E. Dahiphale and S. R. Rao, "A Review paper on Portable Driver
Monitoring System for Real Time Fatigue," 2015 International
Conference on Computing Communication Control and Automation,
Pune, 2015, pp. 558-560.
[2] T. Tangkocharoen and A. Srisuphab, "Vehicle detection on a pint-sized
computer," 2017 9th International Conference on Knowledge and Smart
Technology (KST), Chonburi, 2017, pp. 40-44.
[3] T. Sorwar, S. B. Azad, S. R. Hussain and A. I. Mahmood, "Real-time
Vehicle monitoring for traffic surveillance and adaptive change detection
using Raspberry Pi camera module," 2017 IEEE Region 10 Humanitarian
Technology Conference (R10-HTC), Dhaka, 2017, pp. 481-484.
[4] Mr. AvinashGadekar, Mr. Paresh Joshi, Mr. Ravindra Ardhapure, Mr.
Shankar Waghmare, Prof. Namrata Jadhao, “Review: Smart Traffic
Signal Management System using Image Processing”, International
Research Journal of Engineering and Technology (IRJET) Volume: 04
Issue: 10, October 2017.
[5] A. P. Kulkarni and V. P. Baligar, "Real Time Vehicle Detection,
Tracking and Counting Using Raspberry-Pi," 2020 2nd International
Conference on Innovative Mechanisms for Industry Applications
(ICIMIA), Bangalore, India, 2020, pp. 603-607.
[6] E. Ospina, E. Tascon, J. Valencia, and C. Madrigal, "Traffic flow control
using artificial vision techniques," 2011 6th Colombian Computing
Congress (CCC), Manizales, 2011, pp. 1-4.
[7] M. Soleh, G. Jati, A. T. Sasongko, W. Jatmiko, and M. H. Hilman, "A
real time vehicle counting based on adaptive tracking approach for
highway videos," 2017 International Workshop on Big Data and
Information Security (IWBIS), Jakarta, 2017, pp. 93-98.
[8] M. F. Chowdhury, M. Ryad Ahmed Biplob and J. Uddin, "Real Time
Traffic Density Measurement using Computer Vision and Dynamic
Traffic Control," 2018 Joint 7th International Conference on Informatics,
Electronics & Vision (ICIEV) and 2018 2nd International Conference on
Imaging, Vision & Pattern Recognition (icIVPR), Kitakyushu, Japan,
2018, pp. 353-356.
[9] Amartya Kalapahar, March 2018, www.github.com/amartya-k/vision
[10] Pedro Henrique Fonseca Bertoleti, “Counting objects in movement using
OpenCV and Raspberry Pi”, 2017 December, www.hackster.io
[11] www.smartmotorist.com/average-car-length

Authorized licensed use limited to: UNIVERSITY OF WESTERN ONTARIO. Downloaded on December 20,2020 at 17:39:25 UTC from IEEE Xplore. Restrictions apply.

You might also like