AN ALGORITHM FOR SPEED ESTIMATION AND SPEED VIOLATION DETECTION OF A VEHICLE USING COMPUTER VISION

: Vehicle speed detection and violation detection is in automated way is very useful task for intelligent traffic surveillance system. Vehicle tracking in a precise way is critical task for the process of estimating the speed using only video data. This paper proposes an algorithm to estimate the speed and detecting the violation in precise way. The proposed approach gives the method which contains the optical flow algorithm with corner detection for tracking the vehicle. Proposed algorithm results the better tracking accuracy and better accuracy for speed detection. Also less computation complexity as optical flow is calculated for only corner points.


I. INTRODUCTION
Video based analysis of traffic surveillance is an active area for the research in current scenario. This has a wide variety of applications in Intelligent Transport System. In recent years traffic surveillance using traffic camera is being popular system for automated surveillance.
Traffic monitoring process using Computer Vision is now a day fast growing approach for automated tasks such as vehicle number plate detection, accident detection, traffic flow monitoring, vehicle speed detection etc. These applications are being applied to Government Traffic Monitoring System as a connected camera system in current scenario.
With the growth of Computer Vision in Intelligent Traffic Monitoring System, video camera are low-cost peripheral with great source of information of traffic parameters. Traffic parameters gives information about background and foreground objects, vehicle identification, vehicle characteristics.
Vehicle Speed Detection is main part of the Traffic Monitoring System. There are several basic method for speed detection using hardware. Induction coils are used to detect the speed of vehicle but has drawback as complex installation, can measure only one vehicle at a time [1] [2] .Another approach is speed gun and radar gun. They all are hard to implement and gives the variation in result if view angle changes [3] [7].
Speed Estimation of vehicle using software based methods includes several image processing operations on video dataset. General process for speed estimation includes Image preprocessing, background subtraction, vehicle tracking, and speed calculation operations on images derived from images.

A. Background Subtraction
Identifying moving object from video is critical task in video image processing. It is the fundamental process in video surveillance, traffic monitoring, object tracking, gesture recognition. General approach to identify moving object is background subtraction. Background subtraction is the technique in which each video frame is extracted and compared with another frame or model for background [4]. General process of background subtraction includes pre-processing, creating the background model, extracting nonmoving object (foreground extraction) and validating data [4]. Background modelling is the basic terminology for deriving the background model using methods like Kalman filter, Mixture of Gaussian, Approximated medial model (Recursive methods) also Frame difference method, calculating Median filter and Linear predictive filter(Non-recursive methods) [4].
D.Jeybharathi and Dr. D Dejey [5] derived a method for background subtraction using texture patterns. Generally local patterns (Binary and ternary) are generated using two directional codes [5]. Local Tetra Pattern uses four direction code for extracting pattern feature [5].In Diagonal Hexadecimal Pattern, uniform pattern in generated using diagonal pixels of center pixel. Diagonal Hexadecimal Pattern use the diagonal direction pixel of center pixel. Angle that describes the diagonal (45 0 , 135 0 , 225 0 , 315 0

B. Object Detection and object tracking
) are used to get the background model. Jinhui Lan, Guangda Hu, Bin Ran, Jian Li and Ling Wang [1] proposed improved three frame difference method consecutively doing difference, Dilate, AND, XOR operation performed on three frames.
Object detection is also called Feature Extraction. Identification of moving objects uniquely is necessary to track the object. The figure shows basic method for feature extraction: Diogo Carbonera Luvizon, Bogdan Tomoyuki Nassu, and Rodrigo Minetto [2] used Motion History Image concept to extract the vehicle from the sequence of images. Motion History Image concept uses the approach of detecting motion using past parameters of the frames. Local Pattern can also be used for feature extraction. Uniform pattern uses line, edge and corner as feature extractor [5].
For estimating the speed of object, it is compulsory to track that object precisely. Object tracking mechanism is for tracking the detected object. In other words, object tracking is the process to identify detected object in next frame or say detect the same object in sequence of images. The general algorithm for tracking the object is to detect the variation of pixels from the region detected.
Object tracking method is divided into three types of procedures: Based on Region, Based on Active counter, and based on Feature [6]. Also Kalman Filter, Optical flow algorithms are basic algorithms used for object tracking.
Improved Gray constraint optical flow algorithm is used for vehicle tracking in [1]. Generally in optical flow algorithm, it is assumed that gray value is unchanged in very short time but the actually the value changes. So the Improved Gray constraint algorithm also considers the error caused by the basic algorithm. General optical flow algorithm uses flow field derived using Lucas-Kanade method. HS method-Horn and Schunck method is the method that overcome the error in the basic Lucas-Kanade method. In this method it is assumed that the velocity of brightness pattern remain constant almost everywhere in the image, and based on that it derived the optical flow using iterative implementation [1]. Benchmarking dataset are used for template matching in relevant frames. Many color attributes/features are used as a benchmarking dataset [5].

III. SPEED ESTIMATION ALGORITHM
The aim of the research is to develop algorithm for estimating the speed of vehicle and detecting the violation. In order to track vehicle in a precise way corner detection using Shi-Tomasi method and then applying it for optical flow. Lucas-Kanade method is used for calculating optical flow. Assumptions that are taken are that the camera is single, background is static, and region marking is there for distance calculation.
Main aim of the research is to derive efficient tracking mechanism for vehicle tracking. Object tracking includes different approach. For vehicle tracking, either contour approach or optical flow algorithm can be chosen as it is based on region tracking. Initially first frame is taken for the background subtraction or in other words non-moving object extraction in contour approach and also for the extraction of interested pixels for tracking in another frames (optical flow algorithm). Optical flow algorithm using corner detection is the proposed technique for vehicle tracking The proposed algorithm is as shown in figure 1.
The first step is to extract the frame from video and applying the pre-processing operation to remove the noise and converting the frame into gray-scale. Bilateral filtering is used for smoothing operation. Bilateral filtering is used because it smoothen the gray-scale image with preserving the edges [8].
Corner detection is performed using shi-tomasi corner detection method. Corners are detected by setting parameters for corners like quality level, maximum corners to find, block size.
Features are predefined first. In the first frame corners are extracted and then in next frames, those points are tracked using optical flow. Distance is calculated using Euclidian distance between pixels from two relative frames. Now for speed estimation, frame number and frame rate is considered. Based on the threshold value violation of speed is checked and the notification is given. Hence the algorithm for speed estimation and violation detection can be represented as, Update the array of pixels for using into next frame for tracking.
IV. EXPERIMENTS AND REULTS Python 2.7.14 with OpenCV 3.0 library is used for the system. Distance is calculated in real world and then is converted into pixel difference.

A. Result of Pre-processing
Extracted frame is pre-processed first for better accuracy for tracking. Gray-scale conversion and smoothing operation is performed on every frame before it is processed.

B. Results of Vehicle tracking
Object tracking is performed using optical flow calculated using Lucas-Kanade method. Parameters for Lucas-Kanade tracking is set before optical flow calculation. Set of corner points that are detected in first frame is taken as an input and that points are tracked in other frames.

V. CONCLUSION
An algorithm for speed estimation and speed violation detection can make the traffic monitoring system easier, flexible and usable. Contour approach gives more than one contour for single vehicle. That may result in fluctuation in the speed. Also contour approach gives less detection accuracy in every frame. Whereas optical flow algorithm gives better result for tracking as well as speed estimation. Accuracy is better in optical flow algorithm than contour approach.