Traffic Density Monitoring using Raspberry Pi and OpenCV

SKU: PAN_EMB_049 Categories: , Tag:



The solution we provide for Traffic management by having a special intelligence which the images of road feed from the cameras (webcam or IP camera) at traffic junctions for real time traffic density calculation using image processing. It also focuses on the algorithm for switching the traffic lights according to vehicle density on the road, thereby aiming at reducing the traffic congestion on roads which will help lower the number of accidents. In turn, it will provide safe transit for people and reduce fuel consumption and waiting time. It will also provide significant data which will help in future road planning and analysis. In further stages multiple traffic lights can be synchronized with each other with an aim of even less traffic congestion and free flow of traffic. The vehicles are detected by the system through images instead of using electronic sensors embedded in the pavement. A camera will be placed alongside the traffic light. It will capture images sequences. Image processing is a better technique to control the state change of the traffic light. It shows that it can decrease the traffic congestion and avoids the time being wasted by a green light on an empty road. It is also more reliable in estimating vehicle presence because it uses actual traffic images.


The number of vehicles on the road is increasing day by day so it is important to manage the traffic flow efficiently in order to utilize the existing road capacity in the best possible way. Traffic congestion is a serious issue nowadays especially in big cities. The main reason behind it is the increase in the population that subsequently increase the vehicular travel, which creates congestion problems. This in turn causes an increase in cost of transportation because of wastage of time and fuel. Traffic congestion is a state on road networks that occurs due to increased usage. It is characterized by slower speeds, longer travel times, and increased traffic blocks (queuing). When vehicles are fully stopped for periods of time, this is colloquially called a traffic jam. Traffic congestion can cause drivers becoming frustrated and engaging in road rage. In order to avoid the congestion in traffic islands Traffic Signal System (TSS) is used to regulate traffic from different directions and command each lane when to move. An efficient and robust automatic traffic sign detection and recognition can disburden the driver, and thus, significantly increase driving safety and comfort. Generally, traffic signals provide the driver various information for safe and proper navigation. Earlier it was the sole responsibility of the traffic corps to control the traffic, later manual signal controls were introduced where the traffic corps examine the traffic and control the signals. Then came the automatic recognition of traffic signs therefore, became important for smooth and tension free journeys. The present automated traffic control systems that work on time based algorithms. Each lane is allotted a fixed time for the traffic to clear off, the times may be equal for all lanes or based on the average vehicle density


In existing system, Traffic Density Monitoring using Raspberry Pi and OpenCV .The traffic lights used in India are basically pre-timed wherein the time of each lane to have a green signal is fixed. In a four lane traffic signal one lane is given a green signal at a time. Thus, the traffic light allows the vehicles of all lanes to pass in a sequence. So, the traffic can advance in either straight direction or turn by 90 degrees. So even if the traffic density in a particular lane is the least, it has to wait unnecessarily for a long time and when it gets the green signal it unnecessarily makes other lanes wait for even longer durations.


  • That evaluates the traffic density using IR sensors and accomplishes dynamic timing slots with different levels.
  • A portable controller device is designed to unsolved the problem of emergency vehicles stuck in the overcrowded roads
  • The traffic flow depends on the time of the day where the traffic peak hours


We propose a technique that can be used for traffic control using image processing.? According to the traffic densities on all roads, our model will allocate smartly the time period of green light for each road. We have chosen image processing for calculation of traffic density as cameras are very much cheaper than other devices such as sensors.?The proposed model is constructed as follows: We have a Raspberry Pi that is connected to 4 sets of LED that represent the traffic lights. It is the process of monitoring the traffic density of each side and?change the signal according to the density in every direction.


  • It will be density based that means it will give priority to the lane which has comparatively a greater number of vehicles.
  • Reduce wastage of time and fuel and to saving your time


Traffic Density Monitoring using Raspberry Pi and OpenCV


  • Four cameras are connected with raspberry pi for every direction
  • Lights in each signal are connected to GPIO pins of Raspberry pi
  • The power supply should be given to raspberry pi
  • Power for the Signal light can be given using external power supply using relay switches (Here we are using LED?s as signal lights)


Each camera should be faced in each direction to monitor the traffic density by having a number of boundaries of each vehicle on the road. When the traffic density of one direction is high, green signal will turn?in that direction and rest will be in red. Similarly, by analyzing the order of traffic density traffic signal should be changed in every direction. So that traffic signalling system becomes automatic using image processing through open CV and python.


  • Raspberry Pi
  • Camera-4 (for 4 directions)
  • LED for signals


  • Program: Python
  • Platform: Python 3 IDLE
  • Raspberry pi os: Raspbian os
  • Library: opencv


[1] Somashekhar. G.C, Sarala Shirabadagi, Ravindra S. Hegadi, ? High Density Traffic Management using Image background subtraction Algorithm?, International Journal of Computer Applications (0975 ? 8887) Recent Advances in Information Technology, 2014

[2] ?ngel Serrano, Cristina Conde, Licesio J. Rodr?guez-Arag?n, ?Computer Vision Application: Real Time Smart Traffic Light ?,International Journal of Advances in Engineering & Technology, Nov., 2014

[3] Sachin Grover, Vinay Shankar Saxena, Tarun Vatwani, ?Design of intelligent traffic control system using image segmentation? International Journal of Advances in Engineering & Technology, Nov., 2014. ?IJAET ISSN: 22311963

[4] Dr. Swapan Kumar Deb, Rajiv Kumar Nathr, ?Vehicle detection Based on video for traffic surveillance on road?, International Journal of Computer Science & Emerging Technologies, IJCSET, E-ISSN: 2044- 6004

[5] K.Vidhya, A.Bazila Banu , ?Density Based Traffic Signal System?, International Journal of Innovative Research in Science, Engineering and Technology ,pp 2218-2223,2014


Customer Reviews

There are no reviews yet.

Be the first to review “Traffic Density Monitoring using Raspberry Pi and OpenCV”

Your email address will not be published. Required fields are marked *