Density and Time based Traffic Control System using Video Processing

Traffic is the serious issue which each nation faces due to the expansion in number of vehicles. One of the strategies to beat the traffic issue is to build up a smart traffic control framework which depends on computing the traffic density and about utilizing constant video and picture preparing procedures. The topic is to control the traffic by deciding the traffic density on each roadside and control the traffic signal smartly by utilizing the density data. In this paper, an automated system based on processing of real time videos is proposed for detection of vehicles and recording count of them. The System will consist of various stages which includes Object Car Detection and Signal variation based on density. Captured video will be converted into frames and which will be pre-processed for object detection using Haar-Cascade than detected object count will be used to obtain the density and manipulate the signal accordingly. The density count algorithm works by contrasting the ongoing edge of live video by the reference picture and via looking through vehicles just in the district of intrigue (for example street region). The figured vehicle thickness can be contrasted and other course of the traffic so as to perform control of the traffic flags in more smart and proficient manner.


Introduction
Traffic clogging has become a difficult issue in urban areas. The fundamental explanation is the increase in population in the urban area that along these lines there is high vehicular travel, which births clog issue. Because of traffic blockages there is high cost of transportation as a result of time wastage and additional fuel use [3]. For example, in the event that there is a crisis vehicle with the basic patient ready. In that circumstance if an emergency vehicle stalls out in an overwhelming congested road, at that point there are high possibilities that the patient can't arrive at the clinic on schedule. So, it is critical to structure a keen traffic framework which controls traffic brilliantly to maintain a distance from accidents, crashes and roads turned parking lots [7][8]. The most wellknown explanation of traffic blockage in underdeveloped nations is a traffic signal con-trolling which influences the traffic stream. For example, if one path has less traffic and the other path has more traffic yet the green light is same then it creates problem. By considering the above model if the path with higher traffic thickness should turn on the green signal light for a longer period than the lane with lesser density. It will solve the problem. In other technique it is proposed to control the traffic signal by using image processing, in which they 1 e-mail: tanvi291999@gmail.com 1 * e-mail: parate860@gmail.com 1 e-mail: dharininadkar02@gmail.com initially select the reference picture which is the picture without any vehicles or Less vehicles and each time they co-ordinate ongoing pictures with that reference picture, based on the level of coordinating traffic lights controlled. But in this the image matching is performed by using edge detection [3]. In this paper we propose a density-based counting of vehicles which gives us exact information for signal decision making. They are organized as follows: section II explains the review of literature. Section III shows proposed system. Section IV is with the implementation. Section V shows the result. Finally, Section VI is the conclusion of the paper followed by the key references used for the work.

Review of literature
The proposed system is aimed to give a comprehensive application to dynamically manage the traffic light systems depends on the current vehicle count. Gaussian probabilistic model is used for classification of vehicles, Kalman filter is used to detect the vehicles at the junction of the traffic light timer will be adjusted according. This proposed system will improve the traffic management system significantly by calculating accurate vehicle density on the roads. The proposed system takes the videos of all the traffic lanes at the junction as an input from the local storage of the computer and performs comparison based on the number of cars at the respective lane. The lane with the highest density will be given the priority. The scenario of the starvation of the particular lane is also taken into consideration while developing the system [1].
There are plenty of proposed techniques to build a wise traffic framework, for example, fluffybased controller and morphological edge discovery. This technique is based on traffic density measurement, by relating the live traffic with an image. Other technique is proposed to design an intelligent traffic system, which is on four lanes. This also suggests identification of emergency vehicles, within a restricted scenario. Second technique is proposed based on neural networks, which analyze the traffic videos and classify the vehicles and its density. The proposed technique is based on calculating the traffic load by comparing two pictures. [2].
In this we speak about the camera-video-observation capabilities to track cross sectionally over diverse and changed street environments like vehicle discovery. The system is intended to track road and motorway wellbeing rates, it could detect the vehicles unlawful turn. The system is built using a diverse range of software's. The road intersections are the main focus of this system development. Used microcontroller is Arduino uno, used algorithm is canny. The system successfully reduces the crowd of vehicles and time of waiting through this mechanism at the traffic signals. We have coupled actual traffic images taken with microcontroller. This paper estimates the number of vehicles present, and the density is determined ac-cording to the total. This is intended to develop a system that uses camera to perform execution based on vehicle density, i.e. vehicle counting. It proves that video processing is a better option for calculating traffic density using OpenCV. It implements thickness-based operation system advancing using OpenCV video handling. The blob measurement helps to track the density of the vehicles from the live video recorded for processing. The traffic signal manipulation is successfully achieved through the count of the vehicles detected by the proposed system and reduces the traffic congestion at the intersections [3] [9].

Problem statement
Signals are allocated a fixed time and according to that time it will work but the problem here is even if there are no vehicles in that lane the signal will turn green according to the fixed timer statically allocated to it without any cause. We have to propose a system in which signal lights will be manipulated according to the density of the vehicles in that particular lane. The lane which has a greater number of vehicles will be given a preference. This system has been previously implemented using sensors but we are trying to substitute the whole system into video processing. The substitution results in low costs as there is no need to buy any sensors.

Proposed system
Proposed system is shown in figure 1 and explanation is given below.

Image Acquisition
The system starts with an image acquisition process in which the live video is taken and processed by camera, mounted on the signal stand. The video is captured lane wise, the camera shifts from one lane to another after a specific time interval.

Image cropping
The frames from the video are extracted which are processed further. The second step is the image cropping in which the focus is on region where the vehicles are present and are surrounded by noise and other data. Cropping helps to obtain the ROI for the system which can help to achieve higher accuracy.

RGB to grayscale transformation
RGB Images contains lot of data and it takes time for processing, to minimize this processing time the RGB color images are converted to gray scale and passed to next stages. The equation for rgb to gray scale conversion is given below: Gray=0.2989 * R + 0.5870 * G + 0.1140 * B

Threshold
Thresholding is used for classifying the pixel values in an image which is done on grayscale images, which are images which have pixel values ranging from 0-255. When you threshold an image you classify these pixels into groups setting a upper and lower bound to each group. Thresholding can be performed by local methods as well as by global methods, Thresholding is one of the methods which is used to suppress the background and obtain a clear foreground. In this paper Otsu's Thresholding is ap-plied, it converts the gray scale image to binary form based on the selected threshold value.

Contour
The binarized image obtain from thresholding stage is passed to the contour step to define the contour for the detected objects. Contours can be clarified as basically as a curve joining to every single continuous point having same shade or intensity. The contours are helpful to object detection and recognition.

Calculate traffic density
In this we calculate the density of the number of vehicles present in the lanes by the camera using har cascade algorithm. Which helps to decide the changing of the signal color thus managing the traffic. The input video provided to the system will be checked and the frames will be extracted from it. The noise and other simplifying objects like shadows will be filtered out. The conversion of the extracted frames from rgb to grayscale will be done. After this the contours on the frames will be detected and the object will be successfully detected using Haar-Cascade algorithm. 3. This step will remove the survived noise that is in the video which includes all the things other than the vehicle in the video to prevent from detection, and to simplify the video and identification of the vehicle.
4. This step will remove the survived noise that is in the video which includes all the things other than the vehicle in the video to prevent from detection, and to simplify the video and identification of the vehicle.
5. once the video is detected the video will be in colorful format that is into rgb format, so for the processing of the video the video needs to be in the grayscale format for better processing and according to the algorithm. Hence in this step we convert the RGB video into the grayscale format.
6. contours are basically the boxes formed around a detected vehicle to show that this vehicle is detected or anything that is detected comes under the counters and it gives the system a count of the detected objects.
7. finally, when the objects are countered in the previous step the object are detected with minimum error. In our case the system detects the vehicles as an object using the har cascade algorithm.
The below flowchart is for system architecture. When you turn on the system thee video processing module will open and the module will detect the number of vehicles in the particular lane where the camera is facing. If the vehicles are detected then the module will give us the count of the vehicles detected using the Haar-Cascade algorithm. Once the count is provided the signal will turn green on that particular lane for the time according to the vehicle count detected and the time allotted by the system which in our system, we have given 2 seconds for each vehicle and one extra second. If no vehicles are detected then the camera will move to the next lane to check for the vehicles and repeat the procedure.

Conventional Traffic Control System Manual
Controlling: Manual controlling refers to manual adherence for monitoring and controlling the traffic at the signals. Contingent upon the nations and states the traffic polices are allotted for a necessary region or city to control traffic. They are told to wear explicit garbs so as to control the traffic.

Automatic Controlling:
The traffic lights are automated based on the sensor information and using clock timers for display. In rush hour gridlock light, each stage a steady numerical worth stacked in the clock. The lights are naturally jumping ON and OFF contingent upon the clock worth changes. The automated traffic signals make use of sensors to detect the vehicle availability and a flag is raised at each step, based on the above mechanism the lights turn ON and OFF automatically.

Hardware software requirements
• Ubuntu 19.04 3. This step has the video processing module in which the methods and algorithm is present to detect the vehicles accordingly.
4. This step applies a condition in which if it detects the vehicles has a yes or no answer with the preceding step to be done.
5. If the system does detect the vehicle then it will give the total number of count of vehicles in that lane using the video processing module 6. In this step once the count is given the signal turns green for the time specified according to the algorithm based on the density or count of the vehicles in that particular lane.
7. If the camera detects no vehicle on the particular lane that he is facing then the camera will move and change its direction facing to the other lane to count the vehicle density in that particular lane and repeat from step5.

Implementation
Given system uses OpenCV v3.4.9 for software, and is using the Image Processing principle. The programming language to be used will be python. In the past execution, since desktop monitor is hard to work with, we use Arduino uno micro controllers which make it easy to convert advanced digital language into a binary language. The technique that are used are blob detection and thresholding. The algo being used is Haar-Cascade. Another implementation in this project is using python. We use OpenCV due to which the project's entire cost is lessened.

Figure 4. Image Capturing
The above figure is the image capturing done by our system.

Figure 5. RGB to gray scale transformation
The above image is the transformation of the captured image from RGB to gray scale.

Figure 6. Threshold Image
The above image is the threshold picture of the vehicles detected by our system using Otsu thresholding.

Figure 7. Car Detection by Contours
The above image is the contours detected by our system.

Figure 8. Density Count
The figure 8 shows the count of contours or the density of the vehicles detected by the proposed system.

Result
The lane number 1 has actually 5 number of vehicles present there, our system detects number of vehicles is 6 that is with the accuracy rate of 83.33. The time allotted that is number of seconds per vehicle to cross is 2 seconds and one extra second for any detection. Hence the lane 1 has 13 seconds allotted by the system. The lane 2 has actually 3 cars and our system has detected all 3 cars with the accuracy rate of 100 and the green signal is on for 7 seconds by the system. On peak hours, the camera detects the number of vehicles on its range and turns the green signal ON for 2n+1 seconds. Then camera rotates to another lane.

CONCLUSION
The study showed that video processing is a good technique to control road congestion. It is also more consistent in detecting vehicle presence since it utilizes genuine traffic frames. It envisions the reality so it works far superior to systems which depend on the detection of vehicles. This work can be upgraded further by proposing a framework for controlling the traffic density. That will decrease our serious issue of everyday life, traffic jam. Using video processing and Object Detection mechanism, the proposed system achieves good accuracy in identifying the objects and estimating lane density. Based on lane density the traffic issue can be resolve to greater extent.