Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Abstract - The design and construction of an intelligent Several studies on intelligent traffic control models have
traffic light control system is presented in this work. The sys- also been conducted. Video image processing is used in
tem controls traffic lights based on the density of traffic on [2], [3] and [4] to determine traffic density. Infrared sensors
each side of the intersection. Infrared sensors and Cameras, to detect traffic density using passive or active infrared
combined with an image processing algorithms were used technology [5][6]. Fuzzy logic [7][8] and Genetic algorithms
to detect traffic density. Red-light runners were detected [9] are used to determine traffic density. Video analysis can
using a metal detector as a trigger, and images of offenders be used to detect red light runners by analyzing real-time
are captured. A scaled-down model of a traffic intersection videos of traffic [10] or from cameras within vehicles [11].
is used to demonstrate the efficiency of the system. Results RFID-based detection was used in [12] for detection of red
are comparable to what obtains in the literature. light violations.
Whereas most of the above approaches attempted to
Index Terms—Intelligent traffic control,computer vision, digital image
processing, infrared sensor, red-light camera, metal detector, Canny
solve specific problems using specific technology, such as
Edge detection. traffic control, red-light violation detection, etc., we have
integrated several of these functionality into a single system
and intelligently controlling a plethora of activities. The
approach we have taken allows high quality images to
1 I NTRODUCTION
be stored for further processing. Our system can easily be
Traffic light systems that use fixed-time controls do not extended to Vehicle number detection especially of red-light
respond to traffic conditions causing time and fuel wastage. violators. We are not aware of such an integrated approach
Though a lot work had gone into intelligent traffic control, to traffic control in the literature.
many countries still depend on the fixed time or pro- This paper presents a density-based system of traffic con-
grammable traffic control systems. Fuel wastage from fixed trol using infrared sensors and cameras to estimate traffic
time and programmable traffic control systems increase the volume. Timing for each cycle was estimated dynamically
level of pollution being experienced in the world today. The to reduce time wasted at traffic lights. Both methods were
psychological frustration experienced by drivers who are in implemented to compare the efficiency and limitations of
a hurry and suddenly being stopped by a traffic light with each. Red light cameras were also implemented to detect
no other vehicles on the other sides of the intersection can running of red lights and capture images of offenders. A
only be imagined. model of a 4-way intersection was used to demonstrate how
This work seek to solve these problems by taking advan- the system operates.
tage of advancement in technology to design a workable
prototype using vehicle detection algorithms, single board
micro-controller (Arduino), infra-red sensors and metal de- 2 METHODOLOGY
tectors. In doing the foregoing, our intelligent traffic con- The intelligent traffic light control system consisted of traffic
trol systems compute the timing of each cycle dynamically light control and the red-light camera. Figure 1 shows a
based on traffic density. block diagram of Traffic Light Control (TLC) and Red Light
Various technologies have been used to estimate traffic Camera (RLC). TLC was coordinated by an Arduino Mega.
density, these include inductive-loop detectors, video image Density for two sides of the intersection was detected using
processors, infrared sensors, radar sensors and ultrasonic infrared sensors, and transmitted to a computer. The com-
sensors [1]. These systems may also implement other traffic puter system uses a MATLAB algorithm to activate cameras
monitoring and control methods such as detection of red- and process images captured to find the density for the other
light runners, speed limit detection, collision avoidance two sides of the intersection. The computer system stored
systems, automatic number plate recognition and synchro- the density for all sides in a database using MySQL. The
nization with databases to store information. density information was sent back to the Arduino, which
978-1-5386-2501-9/17/$31.00
c 2017 IEEE
2
calculates the time for the next side of the intersection and one second apart and finding the absolute difference
changes the lights accordingly. The RLC is controlled by between them.
an Arduino Uno connected to a metal detector circuit, an The absolute value was compared with a threshold
SD Card Module and a camera. Another Arduino Uno is value. Metal object detection was registered when the
used to detect frequency in the metal detector circuit and absolute value
recalibrate the circuit after a car has been detected. When When a car was detected, the camera captured an
a car is detected, an image is captured and stored in an image of the offender and saved it to a memory card.
SD card. The RLC Arduino takes an input from the TLC
Arduino to determine when the side of the intersection with
the RLC has a red light. 2.3 Canny Edge Detection Algorithm [19]
Canny edge detection algorithm was used in the imple-
mentation of vehicle detection algorithm. We discuss this
algorithm below.
TABLE 1: State table for traffic light control in one lane respectively (for the model used). To measure
State N E W S Q3 Q2 Q1 Q0 the density and determine time, the highest number of
0 R R R R 0 0 0 0 cars out of the three lanes was determined. Four seconds
1 G R R R 0 0 0 1 was assumed to be enough time for each car to cross the
2 Y R R R 0 0 1 0 intersection. The density was multiplied by four seconds to
4 R G R R 0 1 0 0
5 R Y R R 0 1 0 1
determine the time for the green light.
7 R R R G 0 1 1 1 Infrared sensors : The infrared sensors used are prox-
8 R R R Y 1 0 0 0 imity sensors that produce output analogue voltage propor-
10 R R G R 1 0 1 0 tional to the distance of objects in their field of view [13].
11 R R Y R 1 0 1 1
Each infrared sensor consists of a position sensitive detector,
an infrared light emitting diode and a signal-processing
unit. The detector and emitter have a fixed distance and
3 IMPLEMENTATION
orientation relative to each other, thus the sensor calculates
The model of the intelligent traffic control system is shown the distance of the object by looking at the angle at which
in Figure 2 the emitted light hits the detector and calculating the angle
of the reflected light [14]. A threshold value was chosen to
determine when a car was present. To find the threshold
value for each sensor, the following steps were taken:
x The road was cleared of all cars and the output volt-
age of each sensor was recorded. These values were
recorded over a period of time (five minutes) and the
maximum value used, to increase the accuracy of the
reading.
y A car was placed in front of each sensor at the
outermost lane relative to the sensor. The output
voltages were recorded over a period of time and
the minimum value was used.
z For each sensor, a value that was high enough to
prevent a high signal for an empty road, but low
Fig. 2: Model of traffic light intersection enough to produce a high value when there was a
car in the outermost lane was chosen. The threshold
value for each sensor was chosen as halfway between
The model represented a four-way (+) intersection, with the values in (1) and (2) above.
each side of the intersection having three lanes. It had the For an output voltage higher than the threshold, the Ar-
following components (as numbered in the image): duino registered the presence of a car. To improve accuracy,
Traffic density cameras the output voltage was measured five times a second at 200
Red-light camera millisecond intervals, and the average value was used as the
Red-light camera sensor (inductor) output.
Infrared proximity sensors Cameras : On two sides of the intersection, cameras were
Traffic lights used to acquire images, which were processed with MAT-
The model had four sets of traffic lights, which operated LAB to determine traffic density. The computer transmitted
as standard traffic lights, that is, red-yellow-green-red. Each density information serially from MATLAB to an Arduino
set consisted of three individual traffic lights: one for each Mega. The maximum number of cars in each lane was found
lane. Light Emitting Diodes (LEDs) were used to represent as follows:
the traffic lights. The intelligent traffic light control system
1) An image of the empty road was captured and used
consisted of two parts: Traffic light control and a Red-light
as the background image.
camera.
2) Regions of interest were identified and used to
form masks. The regions of interest were the areas
3.1 Traffic light control occupied by each of the lanes. Steps (1) and (2) were
The traffic lights were controlled using logic circuits pro- performed only once when the program was first
grammed into an Arduino Mega. The inputs Q0, Q1, Q2 and run.
Q3 were used to change the lights, as shown in Table I. The 3) An image of the road with cars present was cap-
required Q inputs were determined using Karnaugh-map tured.
reduction. The letters N, E, S and W represent the North, 4) The absolute difference of the two images was
East, South and West sides of the intersection respectively, found.
and Y, G and R represent yellow, red and green lights 5) The difference image was converted to gray-scale.
respectively. 6) The gray-scale image was converted to a binary im-
Traffic density was measured on a scale from 0 to 3, age. In this image, all pixels with luminance greater
which were the minimum and maximum number of cars than the specified level were replaced with the value
4
1 (white), and all other pixels were replaced with the intersection, saved the density information for all
value 0 (black). The binary image was padded with sides to a database and sent it to the Arduino as a
zeros so that any cars on the border of the image formatted string.
would be detected. 5) The Arduino used the density information to cal-
7) Canny edge detection (Section 2.3) was used to culate the time for the next green light. For the
detect the edges of the cars. This detection method sides of the intersection with cameras, the scale was
finds edges by smoothing the image with a Gaus- divided by 3 to convert it to a scale from 0 to 1. For
sian filter, computing the gradient magnitude and the sides of the intersection with infrared detectors,
orientation using finite-difference approximations there were two conditions: The density was 0 or
for the partial derivatives, and applying non- 2 (neither or both detectors activated respectively)
maxima suppression to the gradient magnitude. The and the value was divided by 2 to convert it to a
technique is especially effective on noisy images scale from 0 to 1; or the density was 1 (one detector
using a double-thresholding algorithm to detect and activated) and the density was taken to be halfway
link edges [15]. between one-car and three-car density. The value
8) The lines of the edges were dilated to make them returned in this case was 2/3.
more prominent and close any gaps present. 6) The scaled density values were multiplied by 12
9) All holes in the image were filled. This produced a (maximum density time) to find the amount of time
solid output for all cars present on the road. for the green light. The time found was sent to the
10) The image at this stage still had noise due to shad- computer to be displayed. If the time was not zero,
ows and other background noise. Blobs (collections the green light was given to the next side of the
of pixels) smaller than a threshold value were re- intersection. Any side of the intersection where no
moved from the image. cars were detected was skipped.
11) The number of blobs in each lane was counted. 7) Once the cycle was completes, steps (3) to (6) were
This was done by applying the mask for each lane repeated.
individually and counting the blobs in the resulting
image. The highest value was used as the estimate
3.2 Red-light Cameras
of traffic density.
The red light camera had two parts: the metal detector and
Figure 3 shows sample the output of the program. camera and SD card control. The metal detector circuit is
The detected vehicles have yellow bounding boxes drawn shown in figure 4
around.
3.2.1 Metal detector Circuit
The Arduino and the computer system communicate Fig. 4: Metal detector circuit [16]
serially to determine traffic density. The following steps
were taken to control the traffic lights:
1) The Arduino transmitted the character ’a’ to the Figure 4 shows the Metal detector circuit. The circuit
computer. was calibrated by taking three measurements one second
2) The computer acknowledged by sending back the apart, and checking whether they were within 200Hz of
character ’a’. This marked the start of serial commu- each other. This was done to prevent false readings due
nication. to the initial instability of the circuit. An NE555 timer was
3) The density for the west and south sides of the inter- used as an Astable Multivibrator to continuously produce
section were determined using infrared sensors as a rectangular wave without any external trigger. An RLC
explained above, and transmitted to the computer. circuit was connected between the output and the trigger-
4) When MATLAB received the string, it determined threshold connection point. When a metal object is brought
the density for the north and east sides of the near an inductor, its inductance changes. The impedance
5
A background image can be selected based on the light of this project will not only increase the effectiveness and
intensity at the time of image acquisition. efficiency of traffic regulating bodies such as the Federal
The metal detector circuit for the red-light camera had Road Safety Corps (FRSC) and the Vehicle Inspection Office
delayed detections caused by the low baud rate used for (VIO), it also has potential to generate revenue.
measuring frequency. When a metal object passed the sensor
at the exact instant the circuit frequency was measured, a
R EFERENCES
delayed response occurred. Using a device with a higher
baud rate and a more stable circuit that does not need [1] U.S. Department of Transportation - Federal Highway Administra-
tion,. ” Traffic Detector Handbook”. 3rd ed., vol. 1. 2006
calibration could solve this problem. [2] M. S. Uddin, A. K. Das, and M. Abu Taleb ”Real-time area based traffic
Improvements can be made to the system to enhance density estimation by image processing for traffic signal control system:
overall speed and accuracy. The traffic control system took Bangladesh perspective”. ”presented at the Electrical Engineering and
approximately two seconds to calculate time based on den- Information Communication Technology (ICEEICT), 2015 International
Conference” Dhaka, 2015.
sity. This was mainly due to the relatively slow processing [3] J.M. Blosseville; C. Krafft; F. Lenoir; V. Motyka; S. Beucher ”TI-
speed of MATLAB and the serial communication between TAN: a traffic measurement system using image processing techniques”
the Arduino and MATLAB. This problem can be solved by ”presented at the Second International Conference on Road Traffic Moni-
toring”. 1989
using a faster computer vision tool such as OpenCV [18] [4] R. Cucchiara; M. Piccardi; P. Mello, Image analysis and rule-based
with C++. In a real-life implementation of the system, an reasoning for a traffic monitoring system Trans. Intell.
integrated, specialized computer (with Graphic Processing Transp. Syst. vol. 1, no. 2, Jun. 2000..
Units (GPUs)) designed specifically for density based traffic [5] T.M. Hussain; A.M. Baig; T.N. Saadawi; S.A. Ahmed, ”Infrared
pyroelectric sensor for detection of vehicular traffic using digital signal
control would make the system much faster and more effi- processing techniques,” IEEE Trans. Veh. Technol, vol. 44, no. 3, Aug.
cient. The red light camera took approximately 27 seconds 1995.
to capture an image and store it in the SD card. In a practical [6] S.A. Ahmed; T.M. Hussain; T.N. Saadawi, ”Active and passive
infrared sensors for vehicular traffic control”. presented at the Vehicular
implementation of the system, this speed is too slow. A Technology Conference, 1994.
high-speed camera and memory system designed for this [7] U. Chinyere Osigwe, O. Francisca Oladipo, and E. Onibere, ”Design
purpose would be an efficient solution to this problem. The and Simulation of an Intelligent Traffic Control System”. Int. J. Adv.
traffic density records stored in the database have many Eng. Technol., vol. 1, no. 5, pp. 4757, Nov. 2011.
[8] Javed Alam and M. K. Pandey Development of Intelligent Traffic Light
applications. They can be used to estimate timing when System Based On Congestion Estimation Using Fuzzy Logic IOSR J.
density information is not available; for planning new road Comput. Eng., vol. 16, no. 3, pp. 3644, Jun. 2014.
networks; and for GPS and navigation applications. Crucial [9] Suhail M. Odeh ”Hybrid algorithm: Fuzzy Logic-Genetic Algorithm on
traffic light intelligent system,” presented at the 2015 IEEE Interna-
information such as frequency and details of accidents for tional Conference on Fuzzy Systems (FUZZ-IEEE), 2015.
each intersection can also be stored in the database. Images [10] Nelson H. C. Yung and H. S. Lai ”An Effective Video Analysis
of red-light runners can be processed to detect their number Method for Detecting Red Light Runners,”. IEEE Trans. Veh. Technol.,
plates, making the process more efficient and less error vol. 50, no. 4, Jul. 2001.
[11] Rafael Henrique Brasil; Alexei Manso Correa Machado ”Automatic
prone than manually reading characters of plate numbers Detection of Red Light Running Using Vehicular Cameras”. IEEE Lat.
from the images. Records of offenders can be stored in a Am. Trans., vol. 15, no. 1, Jan. 2017.
database and the process of prosecution can be automated. [12] Iswanjono, B. Budiardjo, and K. Ramli ”Simulation for RFID-Based
Red Light Violation Detection: Violation Detection and Flow Prediction”.
A renewable power source independent of the national
presented at the 2010 Second International Conference on Com-
grid such as wind or solar power can be integrated into puter Research and Development, 2010.
the system to reduce down time. This would make it more [13] Sharp ”Distance Measuring Sensor”. Sharp
sustainable in countries like Nigeria with unstable power [14] Carnegie Mellon Robotics Academy ”What is different aboutt Sharp
IR Sensor?”.Carnegie Mellon Robotics Academy - Electronics.
supplies. [15] G.T. Shrivakshan; C. Chandrasekar, ”A Comparison of various Edge
As a proof of concept, this work shows that a vision Detection Techniques used in Image Processing”.IJCSI Int. J. Comput.
based Traffic Control system is plausible. We are confident Sci., vol. 9, no. 5, Sep. 2012.
[16] Dilip Raja, ”Metal Detector”.Circuit Digest.
that these results will be improved by using C++ and asso-
[17] LinkSprite ”Tutorial of Using LinkSpritr 2MP UART JPEG Camera
ciated computer vision tools. A faster memory and graphic with Arduino”. LinkSprite, 03-Nov-2014.
(GPUs) systems will facilitate faster access and much better [18] Satya Mallick ”OpenCV (C++ vs Python) vs MATLAB for Computer
results. That we are able to achieve a 2.3% at one intersection Vision”. Learn OpenCV, 2015.
[19] R. Wang, ”Canny Edge Detection,” [Online]. Available:
means that we can achieve similar or lower results in other http://fourier.eng.hmc.edu/e161/lectures/canny/node1.html.
intersections if parameters like lighting and background
thresholds are improved.
6 C ONCLUSION
This work has demonstrated the principle of density-based
timing of traffic light control systems, and the operation of
red-light cameras to capture red light runners. Potentially,
it could be scaled up to develop intelligent traffic control
systems that meet the specific needs of the Nigerian trans-
portation sector. The fully functional system would con-
trol traffic, generate vehicular movement data for decision
making and document traffic offenses. A scaled-up version