Full Paper Proc. of Int. Conf. on Advances in Electrical & Electronics 2012
Real-Time Vehicle Speed Detection Algorithm using Motion Vector Technique 1
S. S. S. Ranjit, 1S. A. Anas, 2S. K. Subramaniam, 1K. C. Lim, 1A. F. I. Fayeez, 1A. R. Amirah 1
Universiti Teknikal Malaysia Melaka, Faculty of Electronics and Computer Engineering, 1 Department of Computer Engineering, 2 Department of Electronics Industry, Hang Tuah Jaya, 76100 Durian Tunggal, Melaka, Malaysia. ranjit.singh@utem.edu.my II. BACKGROUND STUDY
Abstract— Surveillance video camera monitoring system has gained a lot of interest among the research community especially in monitoring vehicle speed. Apart from vehicle speed detection, this algorithm can be used to monitor the traffic condition along the road or highway. The existing surveillance video cameras are rarely used to measure the vehicle speed and estimate the vehicle. A MATLAB algorithm is proposed and developed to associate the developed algorithm with real-time video sequence and images. Development of vehicle speed detection algorithm is based on the vector-valued function and motion vector technique that estimates the velocity of moving vehicle. Index Terms— Speed Detection, Vehicle Detection, VectorValued Function, Vehicle Speed, Moving Vehicle
Numerous researches have been conducted in order to detect or estimate the speed of a moving vehicle using the image processing technique. Research such as [1-4] presents various papers on the real-time vehicle detection and speed estimation. Existing methods applied into vehicle speed detection, including speed detection based on digital aerial images [5], combination value [6] and frame differencing [7] to produce the most successful outcome. Digital aerial images [5, 8] or camera UltraCamd [9] is used in image processing using the image extraction and detection visually and automated extraction and detection [5, 9]. The computed result is also compared with each other and is presented in [5, 9].
I. INTRODUCTION
III. ALGORITHM DEVELOPMENT APPROACH
Block extraction and subtraction technique is known as one of the simplest motion detection technique. This technique has been adopted into video sequence coding for vehicle speed detection based on current and previous images. Each of the image is divided into non-overlapping square blocks to compare with the respective blocks in the current frame and previous image, each blocks are subtracted to estimate the vehicle speed.
Figure 1. Motion detection block diagram
Fig. 1 system comprises of three elements for vehicle speed detection and output is the estimated speed calculated. Surveillance video camera is used as an input for this system to capture the video and saved into a designated folder in the hard drive. MATLAB is the main platform to develop the vehicle speed detection algorithm. The vector-valued function is used to analyze the changes in the block division based on two consecutive images. This paper presents a new vehicle speed detection MATLAB algorithm. This algorithm is to detect the vehicle speed based on real-time video sequence through an offline based algorithm to reduce the elapsed processing time.
© 2012 ACEEE DOI: 02.AETAEE.2012.3.37
Figure 2. Algorithm development architecture for vehicle speed detection
Video consists sequence of static images representing scenes in motion at one time [9]. The video encoding process includes the transformation of the video into sequence of static images. Two extracted images are selected to apply the 67
Full Paper Proc. of Int. Conf. on Advances in Electrical & Electronics 2012 motion estimation process in the developed MATLAB algorithm. Fig. 2 describe the development process of vehicle speed detection algorithm. Standalone images is segmented into 16 × 16 small blocks using the division technique. Each segmented block is extracted in the video coding to be compared with respective to blocks in current image and previous image. This blocks are compared to detect the changes in pixels which is used to estimate the velocity of the respective moving vehicle. A. Video Image Processing Figure 4. Block segmentation and extraction between two respective images
Block subtraction = Block 2 – Block 1
(1)
B. Vehicle Velocity Estimation In image processing processes a video is extracted into sequences of still images. The images are segmented into region of interest known as 16 × 16 blocks. The motion vector technique is applied after the block extraction and subtraction is use to estimate the pixels changes among the two blocks to measure the speed of the moving vehicle. The vectorvalued function is applied into the motion vector to demonstrate the vehicle speed detection algorithm for the video from surveillance cameras.
Figure 5. Two blocks A(r, s) and A (r’, s’) with motion vector MV (r, s) and MV (r’, s’) in current image
Figure 3. Vehicle speed detection algorithm organization
The algorithm ccomputational and elapsed processing time to process the images increases, block extraction and subtraction technique [10] is applied into region of interest which is block based estimate is concentrated instead the complete video sequence or images.
© 2012 ACEEE DOI: 02.AETAEE.2012.3.37
Assume that the block size 16 × 16 simplified as below: Let A(r, s) denotes the block size W × W in the r column and s row of the current frame. Let MV(r, s) = [MVx (r, s), MVy (r, s)]t denotes the motion vector of A(r, s). Two blocks A(r, s) and A(r’, s’) in the current frame illustrated in Fig. 5 when both lie on the same object. Based on Fig. 5, the two blocks with motion vector is calculated. (r’ W – r W) [MVx (r’, s’)] – [MVx (r, s)] + (s’ W – s W) [MVy (r’, s’)] –[MVy (r, s)] = 0 (2) 68
Full Paper Proc. of Int. Conf. on Advances in Electrical & Electronics 2012 which can be further simplified as follows [r’ –r, s’–s] [MV (r’,s’) – [MV(r,s)] = 0 (3) The method denotes the general motion vector function. This method is applied to analyze the moving vehicle from Point A to Point B. The average motion velocity, V of moving object through a displacement (Δd) during a time interval (Δt) is described by the formula, V = (Δd) / (Δt) where: ΔV - the velocity Δd - the change in displacement and Δt - the change in time
Figure 7. Overview of vector-valued function to estimation velocity of moving vehicle
Figure 6. Estimation of moving vehicle from point A to point B
If a moving vehicle travels from Point A to Point B at distance of 30 meters in 3 seconds, the motion velocity is calculated as following. t0 = 0 seconds; t1 = 3 second (s) Δt = t1-t0 = (3-0) second (s) = 3second (s) Δd = 30 meter (s) V = (Δd)/(Δt) = 30 meter (s) / 3 second (s) = 10 meter/second
Figure 8. Vector velocity calculation and estimation
Velocity, VR = (V1)2 + (V2)2 = (V12 + V2)2
C. Vector-valued function for vehicle motion velocity estimation The vector-valued function is an important element in motion vector technique. One or more vector variables can be verify using vector-valued function. The vector-valued function is to verify the respective number of changes in blocks within two consecutive images. The input of a vectorvalued function could be a scalar or a vector while the output of vector-valued function is a vector. The vector-valued function comprises of n scalar functions for each of the coordinates in the image. The vehicle velocity calculation and estimation of the moving vehicle is achieved when vectorvalued function is applied. The vector-valued function formula is described as r(t) = f (t) i + g(t) j + h(t) k where: f, g and h are called scalar function r(t) is component function and i, j and k are called unit vectors
D. Digital Video Recorder (DVR) card setting In order to associate the sequence images with vectorvalued function algorithms, a digital video recorder (DVR) card is required. The DVR card installation is to capture the video from the surveillance cameras and save into a designated folder in the hard drive. DVR cards come in variations of up to 32 channels with various frame rates depending on the record frames. Other than that, DVR card has high compression rates and real-time video recording. DVR card can support recording qualities up to 60 frames per seconds (fps). 1) Calculation for (DVR) card: Time for (DVR) card can capture for 1 frame. 1 frame = 1 / 60 fps = 0.0167 second (s)
60 frames per seconds (fps)
© 2012 ACEEE DOI: 02.AETAEE.2012.3. 37
69
1 frame = 0.0167 seconds (s)
Full Paper Proc. of Int. Conf. on Advances in Electrical & Electronics 2012 Velocity vector is divided by its length to obtain the tangent vector. Tangent vector formula can be described as; (4) To further analyze these coordinates, time t needs to be declared as a real symbolic variable. Next, define r, and take its derivative. The equation differential equation is defined by differentiating each coordinate with respect to the parameter to obtain the vehicle velocity. >> t=syms (‘t’, ‘real’); >> r=[t,t^2] >> rp=diff(r) Based on Fig. 11, the tangent vector unit is examined in MATLAB. The vector-value function path is considered as r(t) = < t, t2 > and the time interval for tangent vector unit is [1, 5]. This following condition is associated with MATLAB commands; >> t=linspace(1,5); >> x=t; y=t.^2; >> plot(x,y) In order to measure and estimate vehicle velocity, the derivation of r(t) is calculated and the magnitude of the vehicle velocity is obtained through calculations as shown.
Figure 9. Motion of moving vehicle from Point A to Point B
2) Distance estimation: Assume the velocity of moving vehicle is at 110 kilometer per hour (km/h). 110 km/h = 110 × 1000 meter (m) 60 × 60 seconds (s) = 110 000 meter (m) 3600 seconds (s) = 30.56 meter per seconds (m/s) Distance, d = 30.56 m/s × 0.0167 s = 0.51 meter (m)
In order to find the tangent vector unit, the vehicle velocity is divided by the magnitude. Figure 10. Moving vehicle from Point A to Point B at 0.51 meters
IV. DISCUSSION Vector-valued function can measure and estimate the vehicle velocity as well as the magnitude of moving vehicle. Velocity is known as vector while magnitude is an instantaneous speed at magnitude of each point that has direction of motion.
The following MATLAB commands are: >> t=1:1:5; >> x=t; y=t.^2; >> xT=2./sqrt(4+16*t.^2); >> yT=4*t./sqrt(4+16*t.^2); >> quiver(x,y,xT,yT,0) V. CONCLUSION Motion vector technique can be involve into video-based algorithm to measure and estimate moving vehicle velocity as well as vehicle speed estimation can be determined through video image processing. Existing algorithms and systems involves come complicated computational processes which are time consuming and required rapid maintenance for operation. The existing surveillance cameras are not used to analyze the images or estimate the vehicle speed and velocity. Developing and integrating a MATLAB based algorithm to process the video images to measure as well as estimate the velocity of vehicles would reduce the previously developed
Figure 11. Moving vehicle position and velocity vector from Point A to Point B
© 2012 ACEEE DOI: 02.AETAEE.2012.3.37
70
Full Paper Proc. of Int. Conf. on Advances in Electrical & Electronics 2012 algorithm shortfalls.
[4] T. Kowsari, S. S. Beauchemin, J. Cho, “Real-time Vehicle Detection and Tracking Using Stereo Vision and Multi-View AdaBoost”, 14th International IEEE Conference on Intelligent Transportation Systems, pp. 1255-1260, 2011. [5] Y. Fumio, L. Wen and T. V. Thuy, “Vehicle Extraction And Speed Detection From Digital Aerial Images” IEEE International Geosciences and Remote Sensing Symposium, pp. 1134-1137, 2008. [6] G. R. Arash, D. Abbas and R. K Mohamed, “Vehicle speed detection in video image sequence using CVS method” International Journal of the Physical Sciences, Volume 5 (17), pp. 2555-2563, 2010. [7] H. A. Rahim, U. U. Sheikh, R. B. Ahmad, A. S. M. Zain and W. N. F. W. Ariffin, “Vehicle Speed Detection Using Frame Differencing for Smart Surveillance System” 10th International Conference on Information Science, Signal Processing and their Applications, 2010. [8] Y. Fumio, S. Daisuki and M. Yoshihisa, “Use of Digital Aerial Images to Detect Damages Due to Earthquakes” The 14th World Conference on Earthquake Engineering, October 2008. [9] Y. Fumio, L. Wen and T. V. Thuy, “Automated Extraction of Vehicle and their Speed from Digital Aerial Images”, Proceeding 27th Asian Conference on Remote Sensing, 6p, 2007. [10] S. S. S Ranjit, H. S. D. S. Jitvinder, K. C. Lim and A. J. Salim, “Motion Analysis for Real-Time Surveillance Video via Block Pixel Analysis Technique” Proceedings of 2011 International Conference on Signal, Image Processing and Applications, pp. 60-64, 2011.
ACKNOWLEDGMENT This research is funded by the Fundamental Research Grant Scheme (FRGS) - Grant No: FRGS/1/2011/FKEKK/TK02/ 1 – F00114, Malaysia. This research is conducted at Universiti Teknikal Malaysia Melaka. We would like to express our gratitude to the Malaysia of Higher Education (MOHE) as well as Universiti Teknikal Malaysia Melaka (UTeM) for the funding. REFERENCES [1] Y. Zhang, C. Geng, D. Yao, L. Peng, “Real-time Traffic Object Detection Technique Based on Improved Background Differencing Algorithm”, The 12 th World Conference on Transportation Research, pp. 1-11, July 2010. [2] L. A. Alexandre, Aurélio C. Campilho, “A 2D Image Motion Detection Method Using a Stationary Camera”. [3] M. S. Temiz , S. Kulur, S. Dogan, “Real Time Speed Estimation from Monocular Video”, International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences, pp. 427-432, 2012.
© 2012 ACEEE DOI: 02.AETAEE.2012.3.37
71