0% found this document useful (0 votes)
11 views

Jianpingwu 2009

Uploaded by

Manikanta Chanda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Jianpingwu 2009

Uploaded by

Manikanta Chanda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Proceedings of 2009 4th International Conference on Computer Science & Education

An Algorithm for Automatic Vehicle Speed Detection


using Video Camera

Jianping Wu, Zhaobin Liu, Jinxiang Li, Caidong Gu, Maoxin Si, Fangyong Tan
JiangSu Province Support Software Engineering R&D Center for Modern Information Technology Application in Enterprise,
Suzhou, China, 215104
Suzhou Vocational University
Suzhou, China, 215104,

Wujp, liuzhaobin, ljx, gucd, smx, [email protected]

Abstract—This paper presents a new method based on digital limit. And another disadvantage is that radar sensor can only
image processing to realize the real-time automatic vehicle speed track one vehicle at any time.
monitoring using video camera. Based on geometric optics, it first
presents a simplified method to accurately map the coordinates in In this paper, we present a new algorithm that takes
image domain into real-world domain. The second part is focused advantage of the digital image processing and camera optics to
on the vehicle detection in digital image frames in video stream. automatically and accurately detect vehicle speed in real-time.
Experiment shows it requires only a single digital video camera The algorithm requires only a single video camera and an
and an onboard computer and can simultaneously monitor onboard processing computer to operate and can
vehicle speeds in multiple lanes. The detected vehicle speed’s simultaneously detect vehicle speeds in multiple lanes with
average error is below 4%. high accuracy, with less than 4% of error, in real time. The
algorithm only requires that the camera is set up directly above
Index Terms—Digital Image Processing, vehicle speed the target road section (at least 5 meters above the road to
detection, computer vision assure satisfactory accuracy) with its optical axis tilting a
certain angle downward from the highway forward direction.
I. INTRODUCTION
The calibration is very simple and is done directly on the video
Vehicle speed monitoring is very important for enforcing frames based on the position of an easy-to-get vanishing point
speed limit laws. It also tells the traffic conditions of the and a vehicle’s known length and width and its information
monitored section of the road of interest. (upper edge position and lower edge position) in a sample
Traditionally, vehicle speed monitoring or detection is image. The calibration does not require any information about
realized using radar technology, specifically radar gun and the camera, such as focal length. The only specification of the
radar detector. Radar is an electromagnetic pulse generated by camera that is needed is its frame rate, or frames per second.
a transmitter, which sends the radio-frequency pulse down the
highway to reflect off a moving vehicle. The reflection induces
a very slight frequency shift, called Doppler Shift. The II. THE MAPPING OF COORDINATES FROM IMAGE DOMAIN
frequency shift can be analyzed to determine the true speed of a TO REAL-WORLD DOMAIN
moving vehicle. Radar has been used to monitor vehicle speed
A. The Formula for Coordinates Mapping between Image
since the end of World War II and is now the ONLY tool
widely used to detect the vehicle speed by police. But the use Domain and Real-world Domain
of radar in speed detection has its limit. The cosine error rises The vehicles’ positions in video images must be
when the radar gun direction is not on the direct path of the transformed into their real-world coordinates, which is a 2D-to-
oncoming traffic. When the radar gun is located at the side of 3D mapping, generally impossible without additional
the road or above the road, the cosine error becomes a constrictions. However, because vehicles can not leave the
significant factor affecting its accuracy. For example, a 15o surface of road plane, vehicles’ motion is essentially a 2-D one,
deviation of the direct path could cause the reading speed 3% which makes the transformation of image coordinates of
less than the real speed and 30o deviation causes 13% error in vehicles’ positions into real-world coordinates a 2D-to-2D
speed reading. In addition, shadowing (radar wave reflection mapping and can be very accurately formulated. The following
from two different vehicles with different heights) and radio- sections are focused on the calculation of the mapping function
frequency interference (error caused by the existence of similar between vehicle’s image coordinates and real-world
band of RF in environment) are two other important factors that coordinates.
cause errors in radar speed detection. Because of these errors, First let’s take a look how the video camera is usually set
local police in United States usually does not ticket a vehicle up when video images are taken on the road traffic. As shown
with the detected speed less than 8 km or less over the speed in Figure 1, the camera is put H above the road with its optical

978-1-4244-3519-7/09/$25.00 ©2009 IEEE ICCSE 2009


978-1-4244-3521-0/09/$25.00 ©2009 IEEE 193
Proceedings of 2009 4th International Conference on Computer Science & Education

axis tilted at an angle θ from the road’s forward direction. We that the distance between an object and lens plane is z and the
can easily deduce the mapping function between image domain distance between an object and the optical axis of the lens is y.
and real-world domain based on geometrical optics. And we assume that the object’s image has a height v and its
distance to the lens plane is w.

1 1 1
= +
Y Y’ f z w
(1)
θ v w v y
Video Camera = , =
y z w z

X Because a video camera’s focal length is generally very


H
small (5 centimeters or less) and the distance between a vehicle
Edge mark 1 zf
w≡ ≅ f
and lens is greater than 5 meters
z >> f
, z− f
θ ,which means that the imaging plane, where CCD array is
located, is very close to the focal point. Indeed, after the
camera setup, w is a constant.
Z In Fig. 1, we have 3 coordinate systems. The first is the
Edge mark 2 real-world coordinate system (x, y, z), where x, y, and z
represent transverse direction in the road surface plane, the
Z’ direction perpendicular to the road surface, and longitudinal or
forward direction in the road surface, respectively. The second
is the camera coordinate system ( x ' , y ' , z ' ) , where x’
represents the horizontal direction in the lens plane and y’
represents the direction perpendicular to x’ direction in the lens
Figure 1. Real World Coordinates and Video Camera Setup. plane, z’ represents the optical axis direction. The third
coordinate system is the image domain system (u , v ) , with u
v Vanishing Point for horizontal direction and v for vertical direction (unit is
(Uv, Vv) pixel). There is a direction mapping relationship as shown in
Equation (1) between camera coordinate system and image
coordinate system. But what we need is the relationship
between real-world coordinate system and image coordinate
system. First we analyze the relationship between real-world
coordinate system and camera coordinate system. To simplify
analysis, we assume that x axis is parallel to x’ axis, which is
generally the case in video-camera setting. Then we have:

x' = x
u
z ' = z cos θ + H sin θ (2)
y ' = z sin θ − H cos θ
Where H is the height of the camera from the road surface
Edge mark 1 Edge mark 2 and θ is the angle between z and z’ axis. Combined with
Equation (1), we have:

v y ' z sin θ − H cos θ


= =
w z ' z cos θ + H sin θ
(3)
u x' x
= =
Figure 2. Image Domain Coordinates w z ' z cos θ + H sin θ
Where (u,v) is the position in image coordinates and (x, y,
In geometrical optics, a camera can be simplified as a z) is the real-world coordinate system and w is the distance
convex lens with focal length f as shown in Fig. 2. We assume

194 978-1-4244-3521-0/09/$25.00 ©2009 IEEE


Proceedings of 2009 4th International Conference on Computer Science & Education

between CCD plane and lens plane, which is a constant after Similarly, we can also derive x from Equations (3) and (4)
the camera is set up.
( z cosθ + h sin θ )u tan θ
It is noted that when z − > ∞ or (u, v) converges to a x=
single point, which is called vanishing point that corresponds to Vv
the infinity distance point in the road surface . We use (Uv, Vv) (9)
u u
to represent vanishing point. = h cscθ = C3
Vv − v Vv − v
wx
U v = lim =0
z → ∞ z cosθ + h sin θ
(4) And the mapping function between the real-world
w( z sin θ − h cosθ ) coordinates and image coordinates can be written as:
Vv = lim = w tan θ
z →∞ z cosθ + h sin θ
⎧ C3u
Equation (4) shows that that after the camera is set up, the ⎪x = V − v
vanishing point is fixed as shown in Fig. 3. Its vertical ⎪ v
coordinate is proportional to tan θ . We can use the property ⎨ (10)
of the vanishing point to calibrate our mapping between image ⎪ z = C1
coordinate system and real-world coordinate system. ⎪⎩ Vv − v
In an image the vanishing point is very easy to find by getting Where (x, z) is the real-world coordinates of a point in the
the cross-section point of two edge mark lines as shown in Fig. road surface plane with z along the road forward direction and
3. We can use this information to calibrate the mapping x along the road’s transverse direction. And (u, v) is the image
function between image coordinates and real-world domain coordinates of the same point with u along the
coordinates. horizontal dimension and v along the vertical dimension. Vv is
We assume a point in the road surface has the real-world the road surface vanishing point vertical coordinate. As shown
coordinates (x, 0, z), and its corresponding image domain in Figure 3, we can use the vanishing point and a vehicle of
(u , v) . Then based on Equation (3) and (4), we known size (length and width) to calibrate Vv, C1 and C2.
coordinates
have: In an image the vanishing point is very easy to find by
getting the cross-section point of two parallel edge mark lines
v tan θ y ' z sin θ − H cos θ as shown in Figure 3. We can use this information to calibrate
= = the mapping function between image coordinates and real-
Vv z ' z cos θ + H sin θ (5) world coordinates.
The Equation (5) can be changed into Equation (6):
2 HVv
z= − H tan θ
sin 2θ (Vv − v) (6)
where H is the height of the location of the video camera
from the road surface and θ is the angle between optical axis
of the camera and road surface. Because both H and θ are
constants after the camera is set up. Equation (6) can be
simplified as:
C1
z= + C2 (7)
Vv − v
2 HVv
Where C1 = and C 2 = − H tan θ are two
sin 2θ
constants related to camera setup. And Because C2 is only a Figure 3 The vanishing point and calibration
translation constant in the road forward direction, we can
eliminate it by moving the origin of our real-world coordinates
by C2. And the Equation (7) can be further simplified to B. The Calibration of the Coordinates Mapping
The calibration is carried out as follows. As shown in
C1
z= (8) Figure 3, we first get the position of the vanishing point (Uv,
Vv − v Vv) of the road surface from the intersection of two edge mark
lines. Then we use a car of known length L and W in the image

978-1-4244-3521-0/09/$25.00 ©2009 IEEE 195


Proceedings of 2009 4th International Conference on Computer Science & Education

to do the calibration. We first draw the smallest rectangle .


covering the car. We obtain the rectangle’s upper left corner
coordinates (u1 , v1 ) and lower right corner coordinates
IV. EXPERIMENTS AND RESULTS
(u 2 , v2 ) , then We implement the algorithm in Visual C++ language and
used a Lenovo W500 laptop powered by an Intel Centrino 2
⎧ W (Vv − v 2 ) vPro CPU working at frequency of 2.0GHZ and Canon video
⎪C1 = u − u camera to carry out our initial experiment. We used 3 cars with
⎪ 2 1
a fixed speed of 80 km/hour to do 10 runs each in a on a
⎨ (11)
⎪C = L (V v − v 1 )(Vv − v 2 )
section of the road. In the 30 cases, the average detected speed
is 78 km/hour with the standard deviation of 1.3 km/hour,
⎪⎩ 2
v1 − v 2 which gives the error of 3.3 km/hour or 4% of error.
V. CONCLUSION
III. VEHICLE DETECTION IN VIDEO IMAGES The video camera-based automatic vehicle speed detection
We use the method similar to Stauffer[1] to first get the is a very accurate and promising technology for future
adaptive background, which is necessary for accurate application in traffic monitoring. It could be a very powerful
segmentation for the vehicle. Then we use the video images to and cost-effective tool in helping enforcing the speed limit law
compare with background image to extract the foreground a and automatic real-time traffic information reporting.
shown in Figure 4. Then we use the method similar to
Cucchiara[2] and Freund[3] to track vehicles’ positions as
shown in Figure 5. ACKNOWLEDGMENT
This research was supported by the Opening Project of
JiangSu Province Support Software Engineering R&D Center
for Modern Information Technology Application in Enterprise
(No. SX200901).

First Author: Jianping Wu, PhD, associate professor, Suzhou


Vocational University. His primary interest is in digital image
processing and its application. He has published more than
twenty research papers in SCI, EI, ISTP indexed publications.

[1] Chris Stauffer,W.E.L Grimson.Adaptive Background Mixture Models


for Real time Tracking. Computer Vision and Pattern Recognition
1999:246-252.
[2] Cucchiara R. Image Analysis and Rule-based Reasoning for a Traffic
Monitoring System. IEEE Transactions on Intelligent Transportation
Systems,2000,1(2):119-130.
Figure 4 The detected vehicles. [3] Freund, P., N. Robust Tracking of Position and Velocity with Kalman
Snakes. IEEE Trans Pattern Analysis and Machine Intelligence, 2000, 22
(6): 564-569.

Figure 5. Vehicle Tracking

196 978-1-4244-3521-0/09/$25.00 ©2009 IEEE

You might also like