Image Processing Technique for Traffic Density Estimation

— Various techniques for the traffic density estimation in heavy traffic have been developed widely. However, most of them suffer from any drawbacks, especially for traffic fulfilling all kinds of vehicles. In the present study, a new technique of traffic density estimation using a macroscopic approach has been developed. This technique used a background construction and a traffic density estimation algorithm. The first algorithm detects parts of the image containing no moving vehicle in front of or behind the moving vehicle using inter-frame difference. After that, an edge detector detects the edge of image part and classifies whether the image can be used as a part of the background image or not. Meanwhile the second algorithm estimates the traffic density by calculating a ratio between the road area covered by vehicle and the total road area. As a result, this technique has a higher accuracy for determining the traffic density compared with the previous techniques.


I. INTRODUCTION
Traffic density estimation is one of the challenging problems in traffic control systems.This provides important data for traffic controlling, routing, and vehicular network traffic scheduling.Drivers choose lanes based on the traffic density information.Therefore, providing the least delay of the real time traffic density information plays an important role on the intelligent transportation systems.
Conventional technology for determining the traffic density, such as inductive loops, sonar or microwave detectors, lacks of some drawbacks.They are expensive to install, not portable, unable to detect slow or stationary vehicles and demanding traffic disruption during installation or maintenance.On the contrary, video based systems have some advantages.They are easy to install, as a part of ramp meters and use in the existing traffic surveillance infrastructure [1].They can be easily upgraded and offer the flexibility to redesign the system and its functionality.Furthermore, those systems also allow vehicle counting, attributes classifying (color, license plate, logo and type) and vehicle's speed measuring [2].
Recently, some image processing techniques have been developed to estimate the traffic density.The techniques generally comprise thresholding, multi-resolution processing, edge detection, background subtraction and inter-frame differencing [3].There are two approaches for road traffic density estimation, microscopic and macroscopic approach [4].
The microscopic approach uses parameters obtained by averaging some parameters of all individual vehicles on the road.These parameters are estimated by detecting each vehicle on the road, calculating the number of the vehicle, and then determining the traffic density.The microscopic approach produces a low accuracy because of it dependence on the quality of the environment, such as lighting and weather [5].Moreover, it cannot be performed reliably on low resolution images or when there are many objects on the scene, for example, on the crowded highway scenes [4].
Another approach, macroscopic approach recovers a holistic representation of traffic flow information directly, without detecting vehicle.This approach directly estimates the traffic density by analyzing the global motion on the video scene.
The macroscopic approaches have been developed by some researchers.Porikli and Li [6] proposed an unsupervised, low-latency traffic congestion estimation algorithm that operates on the MPEG video data.Both extracted congestion features directly on the compressed domain, and employed Gaussian Mixture Hidden Markov Models (GM-HMM).The algorithm could detect the traffic condition but it needs a huge computation loads.
Uddin et.al. [7] proposed an area based technique for detecting a traffic density using image processing on an intelligent traffic light control system.This technique is good at estimating the traffic density with lighter algorithm using the area occupied by the edges of vehicles.The road with a greater area of vehicles edges will be considered as more traffic congested than others.Nevertheless, the technique might produce a low accuracy when a large homogeneous surface vehicle appears on camera.
Dinani et.al. [8] introduced some various new efficient features of macroscopic parameter for distinguishing different traffic states, including a number of key-points, edges of difference-image and moving edges.These features describe the traffic flow without individual vehicles detection and tracking.The results showed a high accuracy performance, but they needed a huge memory to save the template.
Arróspide et.al. [9] and Yana et.al. [10] developed a traffic density estimation techniques using histogram.The existence of vehicle would make an obvious difference between the vehicle and the background color.This would make a higher value of the standard deviation of the intensity histogram.The present vehicle can be detected by an oriented gradient histogram.Moreover, determining traffic density can be done by analyzing the intensity histogram of the image representing detected area [11].This technique needs a lower computation load.However, it cannot distinguish between the congestion condition and the road without vehicle but has a patterned background.The method also estimates that a road with big vehicles has a low traffic density; and a road with small vehicles (like bicycle and motorcycle) has a high traffic density.
To overcome some weaknesses above, a new technique based on a macroscopic approach for determining the traffic density is proposed.This technique comprises of a new background construction and traffic density estimation algorithm.The first algorithm is used to detect parts of the road image containing no moving vehicle lying in front of or behind the moving vehicle that can be used to construct the background image.Meanwhile, the second algorithm is used to estimate the traffic density by calculating a ratio between the surface of the road area occupied by all vehicles and the total road area.

II. EXPERIMENTAL APPARATUS AND PROCEDURE
The experiments were carried out at an intersection controlled by a conventional traffic light and many types of vehicles running on it.The traffic flow was observed by using a SJ6000 sport camera.The camera was mounted and tilted downward at a fixed location on the left side of the intersection lane.The detail information regarding the camera position has been described on the previous work [11].
The traffic flow was recorded by a frame rate of 30 frames per second.The video size used in the experiment is 640 × 480 pixels.The data were extracted into a sequence frame and the selected images were processed by a MATLAB commercial software.
Adjusting a focal length, installation height and angle of the camera, a detection area was delineated from the image.The area comprises some regions of interest (ROI) defined by an operator.Fig. 1 shows some examples of detection areas, showed by white dot lines, and the ROIs, pointed by yellow boxes.The size of ROI depends on the lane width.The ROI number draws their position in row and column.ROI n denotes a ROI at row 10 n . ROIs with the same row number have the same distance from the traffic light.
Fig. 1 shows lanes of intersections with their ROIs.Lane 1, 2 and 4 depict the general lane with a turn left priority.Lane 2, 3 and 4 have lane dividers.Meanwhile, lane 3 and 4 have dynamic patterned backgrounds caused by tree shadows.In case, there is a heavy traffic such in lane 4, a green time of the lane is not enough to allow all vehicles to pass the traffic light.

III. IMAGE PROCESSING TECHNIQUE
The main algorithms used in this work are a background construction and a traffic density estimation.In the following section, both algorithms will be introduced in detail.

A. Background Construction
The new background construction method is proposed based on some assumptions on vehicle flow of an intersection lane below.

1) If the ROI image shows a static object, it means that the ROI may show static vehicle(s) or background
To classify static and moving objects, an inter-frame difference is used.This widely applies the most cast method resulting a good performance [12].If the ROI shows static objects, all pixels at the ROI of the current frame and the previous frame have the same grey value.The average difference between all pixels image at the n-th ROI of the m-th and the (m-1)-th image frame can be calculated by Equation (1).To distinguish the ROI contains only moving or static object, a global threshold T 1 for image binarization is defined.If n-th ROI of the m-th image frame is classified to the ROI contains static object only.Ideally T 1 = 0, however, it is better to set the value greater than zero to anticipate the slightly change of illumination and the resolution limitation.

2) There is no static vehicle in front of or behind a moving vehicle
This assumption can be used because the video uses a frame rate of 30 fps.In this scheme, it is impossible a moving vehicle in m-th frame will show the no moving vehicle in (m+1)-th frame even if a vehicle suddenly stops.It is also impossible, there is no moving vehicle in front of or behind a moving vehicle.If ROI n contains static objects only and the other ROI lying in front of or behind it contains moving object, ROI n image may contain a part of the background image.This assumption can be explained by Equation (2).
By this assumption, it is better to examine the ROIs contain static object lying in the front of or behind the ROIs contain of moving objects only.This can reduce the computation load because the examining the entire ROI is very time consuming.

3) If the ROI image is a part of background image, pixels on the edge and outside ROI show similar intensity
This assumption will verify the ROI, whether it can be used as a part of the background image or only contains a part of a large object.As shown in Fig. 2, the ROI has four sides.If the image in the ROI is a part of the background, the pixels as the edge of the ROI have the same grey value to the pixels at the background image outside the ROI.
From the local coordinate as shown in Fig. 2, the average intensity difference between the spatial pixel point (x,y) at the top edge of the ROI and the background pixel above ROI can be calculated by Equation (3).b(x,-1) denotes the background pixels above r m:n (x,0).In the same manner, the average intensity difference between the spatial pixel point (x,y) at the bottom, left, and right edge of the ROI and the spatial pixel point of the background image outside ROI can be calculated by Equation ( 4), ( 5) and ( 6).
If the value of ΔR top , ΔR bottom , ΔR left , and ΔR right are smaller than a threshold T 2 , the image in the ROI is classified as a part of the background image.Each spatial pixel of the background image is then updated smoothly by the spatial pixels of the ROI by Equation (7).
To construct the background image at the entire ROIs, the following algorithm is executed.1. Calculate inter-frame difference of each ROI by Equation ( 1) and determine if the ROI contains static object only.2. Determine the ROI containing a static object as a part of the image background calculated by Equation (2).

Verify the ROI by determining the ROI's edge shown by Equation (3-6). 4.
Copy the image at the ROI to the background image with Equation (7).
It can be seen that to construct the background image, the algorithm needs the ROI containing the background image part lying in front of or behind the ROI which contains the moving vehicle.The algorithm may be done more quickly when the green signal is given to the lane as when vehicles start to move, the information on the road background can be retrieved.It can be done when the distance between vehicles is bigger than the ROI size.However, in a very heavy traffic, the distance may be smaller than the ROIs size.In this case, the background image of entire ROIs need a longer time.The worst condition is the background image cannot be constructed in entire ROI.In the algorithm, if the entire background image cannot be constructed in a traffic cycle, the lane is concluded in a congestion state.

B. Traffic Density Estimation
In this work, the traffic density is estimated as a road occupancy rate.This parameter depicts the ratio between the area occupied by vehicles and the total surface of the road.The approaches using an optical flow for traffic density estimation obtain traffic information directly without detecting individual vehicles.
The first step in estimating traffic density is determining ROIs which contain objects on the road when the entire background image has been constructed.The algorithm is executed by calculating the difference between the ROI image and the background.The images in the ROI that deviate significantly from the background are considered to be the ROI containing objects.This is done by Equation ( 8) calculation, the average value of the absolute-subtraction result of each spatial pixel point at the ROI with the background pixel in the same spatial pixel point.If ΔR m:n is greater than threshold T 3 , the n-th ROI of the m-th image frame is, containing objects. : It can be seen that the background construction has been used to perform the traffic density estimation.This requires the accurate current background image.In the real condition, the background pattern may be change due to illumination change or any disturbance such as tree or building shadow.To solve the problem, the background construction algorithm must be running to maintenance and updates the background image.In this method, each ROI is classified if it can be used to construct the background image.If the ROI is classified to contain background image only, the background image is updated by the ROI image.However, if the ROI is classified to contain object, the traffic density is updated by increasing the number of ROI contain object.The flowchart used to classify the ROI image can be shown in Fig. 3.In order to determine the area occupied by vehicles, the number of ROI containing object is accumulated.When all ROIs in the frame have been examined, the traffic density D is then estimated directly by dividing the number of ROI containing object and the total number of ROI as expressed in Equation (9).The D value is within the 0…1 range.An empty road should have zero traffic density.However, the real highest traffic density will never reach 1 because in the event of traffic congestion case, vehicles usually maintain a certain safe distance from other vehicles.

A. Traffic Density Estimation
The first part of the proposed analysis background construction.The performance of the algorithm is measured by the accuracy of the constructed background image.Some experiments have been done on the lane of the intersection controlled by a traffic light.The algorithm meets the best result when the signal light is green.Fig. 4 shows the background image result of the intersection lanes shown in Fig. 1.The background images are accurately constructed on Lane 1, 2, and 3. When vehicle move on green time, the distance between vehicles is larger than the ROI size.On Lane 3, the tree shadows and any static object appear on camera are introduced as background images.Meanwhile, in a heavy traffic of 4, the majority of the distance between vehicles is smaller than ROI size.In the later case, the background images are not constructed in entire ROI and the traffic of the lane is concluded to the congestion state.
The new proposed background method updates the background of a road image along with the variance of illumination.The experimental results show that the proposed background construction scheme is superior to traditional background construction and can produce a better quality image.The algorithm is simpler than the other algorithms, such as: the algorithm based on the sigma-delta filter [13], the algorithm based on combining the Median-based estimation and Support Vector Machines [14] and the algorithm based on histogram in YCbCr color space [15].Besides, the new proposed background method quickly updated.Moreover, verifying the ROI image for background by calculating differences between the intensity of the ROI edge with background pixels outside ROI is more time-efficient than verifying by calculating differences between the intensity of all ROI pixels with background [16].

B. Traffic Density Estimation
To analyze the robustness and effectiveness of the proposed traffic density estimation method, several experiments have been done in this study.As shown in Fig. 5, when the vehicles moved toward the camera in two lanes, the ROI marked yellow cycles for the objects.The traffic density values of the Lane 1, 2, and 3 were 0.49, 0.73, and 0.61 respectively.However, as the background image was not constructed on Lane 4, the traffic was concluded in congestion state (D = ∞).It can be seen that the result of the proposed method is more accurate than some others traffic density estimation based on macroscopic approach.Comparing to the method based on the area occupied by the edges of vehicles [7], this proposed method is better in estimating the traffic density even when a large vehicle with homogenous surface appears on the camera.The simpler proposed method also achieves more time-efficient than some other method such that which is based on pattern [6] [7].
In the next research, the proposed method will be real-time implemented in a portable device such as a microprocessor based system to feed traffic density data to an adaptive traffic controller based on pre-timed system [11].As presented in previous research [17], the systems manage the vehicle flow based on signaltiming plans allocated to several types of days.Nevertheless, the green-time of each lane can be automatically modified according to the traffic density data as the result of this proposed method.The longest green time should be given to the lane with its traffic in congestion state.
V. CONCLUSIONS In the present work, a new image processing technique was developed to estimate the traffic density of the road.Those comprehensive works can be concluded as follows: 1.The background image can be constructed by detecting the image area containing static object lying in front of or behind the image area contain of moving object.The image area edge detection is used to verify the image area as the part of background image.2. Traffic density can be estimated by calculating the ratio between the number of the ROI containing object and the total number of ROI. 3. The developed image processing technique is able to estimate the traffic density with higher accuracy and more time-efficient than any other techniques based on macroscopic approach.

Fig. 1 .
Fig. 1.The intersection lane with their region of interest the gray value of the spatial pixel point ) , ( y x at the n-th ROI of the m-th and the (m-1)-th image frame.Meanwhile, x and y are the relative abscissa and ordinate of the pixel in the ROI, X and Y are the width and height of the ROI.

Fig. 2 .
Fig. 2. The edge of ROI r m:n (x,0) denotes the gray value of the spatial pixel at the top edge of the ROI and

Fig. 3 .
Fig. 3.The flowchart for classifying the ROI image

Fig. 5 .
Fig. 5. Detecting ROI contain object to estimate traffic density