Table of Contents
Abstract:
This paper presents an efficient system for real time vehicle counting and color classification system using a surveillance camera for acquiring the traffic video stream. In our method, we propose a system to identify the vehicles based on the image processing techniques, such as background subtraction using kNN classifiers and morphological operations for detecting the vehicles followed by assigning an unique id to the detected vehicles for the counting of detected vehicles.
Furthermore color of the vehicles are identified using color classifying by k-Nearest neighbors Machine Learning Classifier Experimental results show the high accuracy of the proposed method along with low time complexity.
INTRODUCTION
Vehicular traffic management in our daily routine is of greater significance due to increased traffic on the roads. Automatic detection of vehicles in traffic scenes and information extracted from the vehicles can lead to better traffic management in busy roads. Monitoring traffic using image processing techniques helps us to measure parameters such as vehicle speed, flow of traffic, number of vehicles, etc and helps in better controlling of traffic flow. Vehicle detection, classification and counting are very vital for civilian and government applications, such as highway monitoring, traffic planning, toll collection and traffic flow.
Automatic detecting and counting vehicles in CCTV video on highways is a very challenging problem in computer vision and its applications such as to monitor activities at traffic intersections for detecting congestions and then predict the traffic flow in regulating traffic. Manually reviewing the large amount of data they generate is often impractical. This paper aims to test the effectiveness of our proposed method designed to detect and track the vehicles at the inspection videos. Our proposed method uses the adaptive background subtraction technique, followed by morphological operations to locate and detect vehicles and to remove irrelevant objects.
After detection vehicles are being counted followed by color classification of vehicles and is important mainly for Intelligent Transportation System. Vehicle color is the most important factor to determine exterior of vehicle. Color is the significant attribute of the individual to get identified in the traffic images. Vehicle color can efficiently identify the vehicle candidate that can be useful for police force to improve serving performance..
LITERATURE SURVEY
Alain Crouzil et al., presents vision-based system for road vehicle counting and classification. Here a robust segmentation algorithm that detects foreground pixels corresponding to moving vehicles. First, the approach models each pixel of the background with an adaptive Gaussian distribution. This model is coupled with a motion detection procedure, which allows correctly location of moving vehicles in space and time.
Kishor Kumar S.R et al., has proposed background subtraction based morphological transformation for tracking and counting vehicles on highways is proposed. Proposed algorithm segments the image by preserving important edges which improves the adaptive background mixture model and it uses SVM technique for Classification of vehicles. Finally, Mathematical operation is used for the counting of vehicles to generate the report on vehicle flow.
Pratishtha Gupta et al., has proposed automatic detection of predominant color of vehicles from the traffic images captured through CCTV cameras installed at crossings. Firstly vehicle is cropped automatically from the traffic image and then color of individual vehicle is picked according to the probability of frequency of RGB intensity of each pixel. The dominant color is presented as vehicle color in the output.
THE PROPOSED METHOD
In this section, we propose a method to extract the moving foreground objects from a background frame in a video to detect and count the vehicles along with vehicle color classification. It is basically done by following steps.
First video is converted to subsequent frames and median filter is used for pre-processing, further we detect the edges in both the current frame and the background model, by using adaptive background subtraction technique with kNN classifiers to classify vehicles and non vehicles, Further in second step morphological operations and thresholding are carried out to detect vehicles and remove the white noises in the scene. In third step mathematical operation is performed to count the vehicles followed by color identification using color classifying by K-Nearest neighbors Machine Learning Classifier.
MOVING VEHICLE DETECTION AND COUNTING
In this paper, we have developed a system that automatically detects and counts vehicles.
The proposed system consists of five main functions: motion detection, morphological operation, vehicle detection, vehicle counting and vehicle color classification. The input to the system is a video footage while the output of the system is an absolute number of vehicles. The following sections describe the different processing steps for the trajectory counting system.
Motion Detection of vehicles by
Background Subtractor using KNN classifiers
Motion detection, which provides a classification of the pixels into either foreground or background. A common approach to detect moving objects is background subtraction which is a major preprocessing steps in many vision based applications. The basic principle of Background subtraction algorithm is that the image’s foreground is extracted for futher processing. Image’s region of interest are the objects in its foreground.
Those objects may be humans, cars or text. As shown in the figure 1.the background was modeled based on a sub-pixel edge map, wherein it describes how background foreground segmentation can be performed by using a background model. When a background model is initialized, the foreground can be segmented out by detecting differences between the current frame and the background model. The difference between the model and the current frame can be calculated in several ways. Most straightforward is to calculate the euclidian distance, D,
Exterior environment conditions like illumination variations, casted shadows, and occlusions can affect motion detection and lead to wrong counting results. Hence a more sophisticated approach, k-nearest neighbor (kNN) method is used for better kernel density estimation.
The method is implemented using the OpenCV library in python, wherein background subtraction library with default parameters classification is implemented which finds a group of k objects in the training set that are closest to the test object, and bases the assignment of a label on the predominance of a particular class in this neighborhood. As shown in the figure 2 a similarity metric is used to compute distance between objects, and the value of k, the number of nearest neighbors and the class labels of these nearest neighbours are then used to determine the vehicle and non-vehicle object.
After video segmentation, the segmented objects and centroids are extracted from each frame. Intuitively, two segments that are spatially the closest in the adjacent frames are connected. Euclidean distance is used to measure the distance between their centroids.
Morphology deals with shape and structure of all the vehicles. Morphological transformation is collection of operations to structure the shape of an object from the image.
It finds the holes in the image by overlapping. Basic operations of morphological operations are dilation and erosion. In this section, morphological operations are used for matching patterns related to the vehicles.
Output image includes the only edges related to the vehicles. After background and foreground binary masks exist for all frames of each recording as shown in figure 3. Parts that are incorrectly classified as foreground, such as shadows or noise, were removed from the foreground. Parts that belong to the foreground but were incorrectly classified as background, such as vehicles, were added to the foreground. The resulting binary masks were processed.
Binarization of cars
First we perform Opening (Erosion followed by Dilation)which is applied to remove noise in the mask. Thereafter we perform Closing (Dilation followed by Erosion) applied to fill holes in the binary mask. The size of the kernels used for opening and closing differed for each recording. As shown in figure 4, dilation is a convolution of image with the matrix with the maximum values. Overlapped values are calculated and anchor point is replaced with the maximum value. It sets a pixel value to 1 if at least one of the pixel under the kernel has value 1.
Similarly as shown in figure 5, erosion computes a local minimum over the area of the kernel and when a kernel1 slides over the binary mask and a pixel in the mask is set to 1 only if all pixels under the kernel is 1, otherwise eroded to 0.
Vehicle detection
After Morphological Operations vehicles are detected by using Contour Detection each frame objects are identified. The objects are extracted and stored in to the contour vector. Then contour vector is used to extract features of an object and features are extracted, Attributes like position and numbers of pixels of an object are stored in vector. From number of pixels, area is calculated. Likewise other features are extracted in this step for detecting the vehicles. Rectangle is drawn around the detected vehicle by finding width and length of vehicle. Ratio of width and length creates importance in presence of occlusion of vehicles.
Vehicle counting
After vehicles are detected we define an unique id to all detected vehicles further counting zone delimited by four virtual lines to count the vehicles moving upside and downside .This zone has to be large enough to avoid too many false positives and small enough to count every vehicle whatever its size. A vehicle is counted if it crosses the counting zone, i.e., if its trajectory begins before the entry line and continues after the exit line.
Vehicle color classification
Vehicle color classification is an important application in Intelligent Transportation system. Here the extraction of color from traffic images captured through CCTV cameras by cropping the detected vehicles. The color classification is carried out by k-Nearest Neighbors Machine Learning Classifier which is trained by R, G, B Color Histogram. Each cropped image of vehicle is handled individually and scanned from top to bottom.
First we compute pixel wise RGB intensity of cropped vehicle image. Further comparison of RGB intensity of each pixel is compared with each other, a variable i.e. frequency is maintained which is updated when intensity matches with previous intensity. RGB intensity having maximum frequency of occurrence is reflected as the color of vehicle.
Experimental RESULTS
For testing the proposed method, we used several traffic video. Figure 8 shows the final count and color of the detected vehicle. In test we considered the several traffic videos wherein we have considered the cases of vehicle movem
Conclusion and future work
[image: ]In this paper, we have proposed an efficient system for vehicle counting and color classification. The system has been tested with different kinds of illumination changes such as cloudy, sunny, transitions between sun and clouds. The implemented algorithm based on the background subtraction using kNN classifier method and morphological binary methods is able to eliminate several kinds of shadows depending on the time of the day.
Another particular strength of the method proposed is its ability to deal with occlusions between vehicles. Here it distinguish and number the moving foreground objects (vehicles) from a stationary background image. Furthermore mathematical operation is used for the counting of vehicles by assigning unique id to the detected vehicles to avoid repeated counting of the same vehicle.
In addition to counting of the vehicles, color of the vehicles is been identified using color classifying by K-Nearest neighbors Machine Learning Classifier. As a future work, it can be implemented for moving camera and also for heavy congested night traffic conditions to detect and count vehicles appropriately.
References:
- Gopal Manne, Neetesh Raghuwanshi “Vehicle Detection from Video using Morphological Operations” International Journal of Science, Engineering and Technology Research (IJSETR) Volume 6, Issue 4, April 2017, ISSN: 2278 -7798.
- Reza Javadzadeh, Ehsan Banihashemi “ Fast Vehicle Detection and Counting Using Background Subtraction Technique and Prewitt Edge Detection” International Journal of Computer Science and Telecommunications [Volume 6, Issue 10, November 2015]
- Pradeep Kumar Mishra “Multiple Kernel Based KNN Classifiers for Vehicle Classification” International Journal of Computer Applications (0975 – 8887) Volume 71 – No. 6, june 2013
- Vishakha Gaikwad, Balwant Sonkamble “ Analysis and Classification of Vehicle using KNN and Decision Tree” ,International Journal of Advanced Research in Computer Science Volume 6, No. 2, March-April 2015
- Mallikarjuna & Vishwanath P “An Efficient System on Morphological Operations to Detect Vehicles” International Journal of Theoretical and Applied Mechanics. ISSN 0973-6085 Volume 12, Number 2 (2017) pp. 343-355 © Research India Publications
- Kishor Kumar S.R and Sampath “Vehicle Detection, Classification And Counting” March 2017, IJIRT ,Volume 3 Issue 10, ISSN: 2349-6002
- Pratishtha Gupta & G N Purohit, “Vehicle Colour Recognition System using CCTV Cameras”, International Journal of Advanced Research in Computer Science and Software Engineering , Volume 4, Issue 1, Jan 2014
- Y. T. Wu, J. H. Kao and M. Y. Shih, “A Vehicle color classification method for video surveillance system concerning model-based background subtraction”, Advances in Multimedia Information Processing – PCM, Springer- Verlag Berlin Heidelberg, Vol. 6297, pp. 369-380, 2010
- L. Unzueta et al., “Adaptive multicue background subtraction for robust vehicle counting and classification,” IEEE Trans. Intell. Transp. Syst.13, 527–540 (2012).
- Prutha Y M , Anuradha S “ Morphological Image Processing Approach of Vehicle Detection for Real-Time Traffic Analysis”, International Journal of Engineering Research & Technology (IJERT) ISSN: 2278-0181 IJERTV3IS051443 Vol. 3 Issue 5, May – 2014.
- B. Li and R. Chellappa, “A generic approach to simultaneous tracking and verification in video,” IEEE Trans. on Image Processing, vol. 11, no. 5, pp. 530-544, May 2002.
- H. Tao, H. S. Sawhney, “Object tracking with Bayesian estimation of dynamic layer representations”, IEEE Trans. on Pattern Analysis and Machine Intelligence, vol. 24, no. 1, pp. 75-89, Jan. 2002.
- K. Baker and G. Sullivan, “Performance assessment of model based tracking” Proc. of the IEEE Workshop on Applications of Computer Vision, Palm Springs, CA, pp. 28-35, 1992.
- Z. Kim and J. Malik, “High-Quality Vehicle Trajectory Generation from Video Data Based on Vehicle Detection and Description”, Proc. of IEEE Conf. on Intelligent Transportation Systems, pp.176-182, 2003.
- Lei Xie, Guangxi Zhu, Yuqi Wang, Haixiang Xu, Zhenming Zhang, “Real-time Vehicles Tracking Based on Kalman Filter in a Video-based ITS”, Proc. of IEEE Conf. on Communications, Circuits and Systems, vol. 2, p. 886, May 2005.
- Jun-Wei Hsieh, Shih-Ho Yung-Sheng Chen, and Wen-Fong Hu, “Automatic Traffic Surveillance System for Vehicle Tracking and Classification”, IEEE Trans. on Intelligent Transportation Systems, vol. 7, pp. 175-187, June 2006
- Goyette, N., Jodoin, P., Porikli, F. “Change detection.net: A new change detection benchmark dataset”. roceedings of the 2012 Computer Vision and Pattern Recognition Workshops (CVPRW), 2012 IEEE Computer Society Conference on 16-21 June 2012.
- Gupte, S., Masoud, O., Martin, R. F. K. “Detection and classification of vehicles. Intelligent Transportation Systems”, IEEE Transactions on, 3(1), 37-47. doi: 10.1109/6979.994794
- Hadi, R. A., Sulong, G., & George, L. E. Vehicle Detection and Tracking Techniques: A Concise Review. Signal & Image Processing: An International Journal
- Han, B., Roberts, W., Wu, D. and Li, J. “Motion-segmentation-based change detection”. SPIE Defence & Security symposium 2007, 65680Q-65680Q. doi: 10.1117/12.720308
- De Silva, G. C. (2001). Automation of Traffic Flow Measurement Using Video Images. Master of Engineering, University of Moratuwa, Sri Lanka.