Vehicle detection using background subtraction and clustering algorithms

Traffic congestion has raised worldwide as a result of growing motorization, urbanization, and population. In fact, congestion reduces the efficiency of transportation infrastructure usage and increases travel time, air pollutions as well as fuel consumption. Then, Intelligent Transportation System (ITS) comes as a solution of this problem by implementing information technology and communications networks. One classical option of Intelligent Transportation Systems is video camera technology. Particularly, the video system has been applied to collect traffic data including vehicle detection and analysis. However, this application still has limitation when it has to deal with a complex traffic and environmental condition. Thus, the research proposes OTSU, FCM and K-means methods and their comparison in video image processing. OTSU is a classical algorithm used in image segmentation, which is able to cluster pixels into foreground and background. However, only FCM (Fuzzy C-Means) and K-means algorithms have been successfully applied to cluster pixels without supervision. Therefore, these methods seem to be more potential to generate the MSE values for defining a clearer threshold for background subtraction on a moving object with varying environmental conditions. Comparison of these methods is assessed from MSE and PSNR values. The best MSE result is demonstrated from K-means and a good PSNR is obtained from FCM. Thus, the application of the clustering algorithms in detection of moving objects in various condition is more promising.


Introduction
In transportation, vehicle detection systems can be defined as systems capable of detecting vehicles and measuring traffic parameters such as counting, speed, incident, etc [1,2].Vehicle detection can also be taken advantages of various transportation applications such as: vehicle navigation system, vehicle security, safety and others.The detection of vehicles with video cameras is one of the most promising non-intrusive technologies for large-scale data collection and adoption of sophisticated traffic control and management.Vehicle detection is also the basis of vehicle tracking.Correct vehicle detection results in better tracking.Vehicle tracking methods are highly influential in tracking results [3][4][5].In addition, due to advancement in digital technology, camera is getting cheaper in production, so computer processing of digital image and video is also becoming faster and more cost effective [6][7][8][9][10].Tracking of recorded videos in varying environmental conditions provides a difficult processing time during image segmentation of video [11,12].Various conditions affect the image quality of the resulting video recordings.For instance, the effects of lighting during the night and the rain result in very low quality video recording.The reason is that the lighting at night often undergoes drastic changes as well as rain that can degrade the image quality in video [3,13].
Most static camera-based tracking systems use background subtraction method [14][15][16].The main process in this method is analysing useful video sequences to extract the foreground and background images.This can be achieved by initially modelling the background of the video image.And in separating the foreground and the background, an appropriate threshold value is required [5,[15][16][17].OTSU algorithm is the most classical subtraction background method used to segment an image.However, in determining threshold, OTSU algorithm cannot detect image optimally when dealing with other images in grey level.The shortcomings of the OTSU algorithm have been resolved by several researchers.Bhargava [18] noted that in addition to efficient, clustering method is able to provide  ISSN: 1693-6930 TELKOMNIKA Vol.17, No. 3, June 2019: 1393-1398 1394 segmentation results in the image better and adaptive to changes in the environment and quick momentary changes.There are various types of clustering: K-means clustering, Fuzzy C-means clustering, mountain clustering method and subtractive clustering method [19][20][21][22][23].This study is focused on the tracking of moving objects performed under various environmental conditions, which are recorded in a static video camera and a condition where the image quality is low.By proposing adaptive threshold algorithm obtained from FCM and K-means algorithm, it is expected that the accuracy to detect moving objects in the various environment condition is intensified.

Related Reasearch
There are numerous studies conducted on the detection of moving objects, which can be seen in the Table 1 [17,18,24,25].The detection of moving objects has been done using simple background reduction.Single moving object tracking has been done utilizing the modified shifting mean method and Kalman filter

Technique of Selecting Threshold
Thresholding is the simplest method of image segmentation.Individual pixels in a grayscale image are marked as 'object' pixels if their value is greater than certain threshold value (assuming the object is brighter than the background) and as a 'background' pixels in the other way round [2,24].Thresholding techniques, which are used in this research are background subtraction and clustering.Background subtraction is performed by using OTSU while clustering is conducted by employing FCM and K-means.

OTSU
The OTSU method performs discriminant analysis by determining a variable by distinguishing between two or more groups naturally.The OTSU method starts with normalizing the image histogram as a probability discrete density function as: where n is the total number of pixels in the image, nq is the number of pixels rq, and L is the total number of image intensity levels.In determining the value of T by maximizing between class variances is defined as follows: which is obtained from: (5)

Fuzzy C-Means (FCM)
FCM generates matrixes that contain ownership of multiple objects in each cluster.In FCM, threshold is defined as the average value of maximum on the object with the smallest and minimum center with middle center.
where for the above formula shows the ownership of each pixel in the cluster: The first step of FCM algorithm is the searching of data input in the image.After that, it will select the number of the cluster and its value.And then the division of the matrix is calculated using: finally, the cluster in the center is changed with new cluster:

K-Means
The K-means algorithm is the most famous and widely used as clustering method in many fields because it is simple, easy to implement, has the ability to cluster large data, able to handle outlier data and linear time complexity O(nKT), where n is the number of documents, K is the number of clusters and T is the number of iterations.K-means algorithm is a partitioning clustering method that separates data into different groups.This algorithm works on numeric attribute.With iterative partitioning, the K-means algorithm is able to minimize the average distance of each data to its cluster.K-means algorithm consists of the following steps: (1) determining the value of k as the number of clusters to be formed, (2) generating the initial centroid (cluster center point) at random, (3) calculating the distance of each data to each cluster center by using the formula of correlation between two objects i.e.Euclidean Distance, (4) grouping any data based on the closest distance between the data and the center, and then (5) determining the position of a new cluster center by calculating the mean value of the data that is in the same cluster center.

Research Method
The method proposed for this research applies K-means and FCM algorithm to the background subtraction with frame difference in pixel grouping of the image into the foreground or background.Figure 1 shows the proposed method.Video data as input data is image data prepared in the initial data processing, made in the experimental folder.Then a boundary between pixels as foreground and background is given in the process using background subtraction.Finally Morphology is utilized to get a good object in the detection.

Results and Analysis
The comparison of the experiment results is summarized in the following Table 2. Table 2 depicts the segmentation result.It can be seen that the K-Means and FCM method is very robust in changes compared to OTSU, so more frequent changes from each frame.Measurement of evaluation utilizes Mean Square Error (MSE) and Peak Signal to Noise Ratio (PSNR) to know the accuracy of each method, which are calculated using the following formulas [26,27]: (, ) = 10.log (  2 (,) where X is the actual image, Y is the segmentation image of the MxN size and max is the maximum pixel value range of the image.Table 3 shows the MSE and PSNR average result.
The histogram images of MSE and PSNR measurements between OTSU, FCM and K-Means can be seen in the following Figures 2 and 3.  Based on the graphs shown in the figures above, there are many values of MSE approaching 0, which can be interpreted that the results of the image and the results of manual tracking does not appear so there is a difference or no moving objects in the frame.Meanwhile, when there are moving objects, the results obtained from OTSU, FCM and K-Means have values higher than 0. It is figured out that the K-Means method is able to obtain detail changes better than FCM and OTSU.As for PSNR tends to be infinite, a very good value is depicted from the one greater than zero.

Conclusion
From the experimental research on the detection of moving objects, it can be summarized that K-Means and FCM algorithms are superior to the OTSU algorithm.In addition, many other researches also demonstrated that the cluster algorithm without supervision, which has been successfully applied to some problems in pixels is FCM.It can be said that the mean values of PSNR obtained from the three methods are quite good.Nevertheless, the one generated by FCM produces the best PSNR, which is greater than the other methods.So it can be concluded that clustering algorithms (K-means and FCM) are more prominant to the background subtraction algorithm (OTSU).The MSE values generated from K-Means and FCM algorithms show fewer errors, thus the application of the clustering algorithms in detection of moving objects in various condition is more promising.

Figure 1 .
Figure 1.The proposed method

Table 1 .
Research Related to Moving Object Detection

Table 3 .
MSE and PSNR Average Result