You are on page 1of 4

2014 Fourth International Conference on Communication Systems and Network Technologies

A Camera Calibration Method for Obstacle Distance Measurement based on


Monocular Vision

Lin Chenchen, Su Fulin, Wang Haitao, Gao Jianjun


Harbin Institute of Technology, School of Electronics information Engineering
Harbin, China
daisy_hit@hit.edu.cn

Abstract—This paper presents a novel method of camera camera calibration. In the end, the camera parameters and the
parameters calibration for obstacle distance measurement frame coordinates of obstacle are put into range equation to
based on monocular vision. In this method, resolving camera get the distance from obstacle to camera. The results of
parameters have been decomposed into two linear equation experiment prove that this algorithm has good engineering
sets, which has significantly reduced computing complexity and value in the areas of vehicle assistant driving, computer
improved computing speed. The ideal pinhole imaging model vision and other numerous fields.
of obstacle has been demonstrated, then the linear equations
have been derived afterwards. In the end, experiment shows II. THE PINEHOLE MODEL
that the proposed method is very effective.
In engineering practice, the object distances are usually
Keywords-monocular vision; distance measurement; camera considerably larger than the focal length, where the pinhole
calibration; computer vision perspective can be employed instead of lens imaging model.
Based on the pinhole camera model, the geometry
relationship between actual obstacle point P and its
I. INTRODUCTION
projection point on the image plane P1 is shown in Fig. 1.
Obstacle distance measurement with computer vision has According to [5], the distance from obstacle point to
received a lot of attention over the past few years. Compared camera is
with solutions based on Radar, Lidar and ultrasonic wave, it h
has a series of advantages, such as broad sensing area, d . (1)
complete information, competitive price and matching the tan(  arctan[( y0  y ) / f ])
habit of human cognition. As one of basic robot navigation Here, αis the pitch angle of camera; h is the height of the
techniques, the visual range detection has been widely used camera from the ground; (x0, y0) is the cross point of optical
in target tracking and obstacle avoidance. axis of the camera and the image plane; y is the vertical
There are two basic approaches for visual-based range coordinate of P1.
finding: monocular vision and binocular stereo vision. While In respect that digital images are spatially discrete, we
binocular vision has the advantage of higher accuracy, it can only get the matrix stored in the computer memory, and
requires more memory space and time for the its elements are defined as pixel locations (u, v), whose
correspondence points matching procedure, more power default unit is pixel. In practice, several parameters are
consumption and more space for mounting the camera [1]. needed to convert data from real world to image frame
On the contrary, by employing the mature grey-scale map coordinate system. These parameters can be classified as the
processing technology, monocular vision is featured on intrinsic parameters and extrinsic parameters. The intrinsic
simple calculation. Thus, it is possible to accomplish real- parameters relate the camera’s coordinate system to the
time monitoring with less cost as an end product. idealized coordinate system, which mainly include focal
Many researchers focused on distance measurement length of the lens f, the size of the pixels dx, dy and the
using monocular vision. A common method is combining the position of the image center (u0, v0). And the extrinsic
depth perception with pattern recognition, and an experiment parameters, such as the position and orientation of the
has validated the algorithm by using a fully self-contained camera, relate the camera’s coordinate system to a world
micro aerial vehicle with on-board image processing [2]. coordinate [6].
Another method proposed by Z. Zhang is based on the Let dx, dy denote the physical dimension of one pixel
relationship among projection points [3]. Research has also along the x-axis and the y-axis separately. Then as is shown
resorted to various approaches such as structure from motion in Fig. 1, the coordinates of point P1 in the image coordinate
[4], which try to imitate the stereo vision by using several plane xO1y and its position in the camera’s reference frame
images taken by one single camera at different time. uO0v are related by the transform equation
A novel camera calibration method is demonstrated in
this paper. Firstly a measurement equation is devised
according to the pinhole model and projection geometry.
Secondly, the nonlinear problem is transformed into two
linear equations by variable substitution in the process of

978-1-4799-3070-8/14 $31.00 © 2014 IEEE 1148


DOI 10.1109/CSNT.2014.233
Z determined by the camera parameters fy, v0, α, and the
Optical axis vertical coordinate of obstacle in pixel coordinate system v.
If fy, v0, α, are known, the sole determinant of h would be v.
0 P1 However, fy, v0, α are unknown in most circumstances, this
problem can be solved by the following method.
1 Lens Suppose that we have already got three calibration points,
and the relevant parameters are known, which are distances
f from camera to objects (d1, d2, d3), pixel location (v1, v2, v3,)

and the height of camera from floor (h), we can get the
camera parameters by solving equations as below
Image plane h d1  h / tan(  arctan[(v0  v1 ) / f y ])
Y 
P d 2  h / tan(  arctan[(v0  v2 ) / f y ]). (4)
d 
X
(a)
d3  h / tan(  arctan[(v0  v3 ) / f y ])
Obviously, as a nonlinear equation system, (4) is not easy
O0 to be solved. To simplify the calculation, we established two
u linear equation systems by variable substitution. Detailed
P1(x,y) steps are demonstrated as follows.
x Firstly, (3) can be written as
O1(u0,v0)
f y  B(v  v0 )
d h , where B  tan  . (5)
Bf y  (v  v0 )
Image plane
v y With
(b) C  d v , (6)
Equation (5) can be expressed as
d (v0  Bf y )  h( f y  Bv0 )  vBh  C . (7)
Figure 1. The pinhole imaging model of obstacle point P: (a) equation (1)
is derived from this projection model; (b) it shows the relation of idealized Next, let
image coordinate system xO1y to camera’s pixel location coordinate
sysytem uO0v.  x1  v0  Bf y

x2  f y  Bv0 . (8)
u
x
 u0 , v 
y
 v0 . 
dx dy
(2)
x3  B
Therefore, the distance can be obtained as And (7) changes into
h dx1  hx2  vhx3  C. (9)
d . (3)
tan(  arctan[(v0  v) / f y ]) If x1, x2, x3, are known, fy, v0, B can be calculated, then we
can get the values of fy, v0, α with the definition of B=tanα.
Here, fy = f/dy. Thus, in order to get the distance d, we
So the next problem is solving x1, x2, x3.
can solve the ratio fy rather than calculating the optical length
and pixel physical dimension separately. Equation (9) can be rewritten in a matrix form as follows
In theory, as the corresponding pixel location of (x0, y0), x = M 1c . (10)
O1 (u0, v0) usually located in the center of image. But in fact,
Here,
there might be slight departure due to fabrication. In that case,
the actual position, (u0, v0), are need to be measured for the d1 , h, v1h x1 C1
purpose of detecting object distance d. In this paper, the  d , h, v h   M ,  x   x, C   c
 2 2   2  2 . (11)
nonlinear aberrations associated with real lenses are not  d3 , h, v3 h   x3  C3 
taken into account.
In conclusion, with the purpose of getting the obstacle Camera height h, distance from obstacles to the camera
distance, several camera parameters, which including fy, v0, h, (d1, d2, d3) and corresponding coordinates (v1, v2, v3) are
α, are needed. Therefore, the range measurement problem known. Besides, we can also get the value of C1, C2, C3
mainly focuses on the camera calibration. according to (6). Put all of them into (10), then x1, x2, x3 will
be obtained. The result of (9) is
III. THE CAMERA CALIBRATION METHOD
 B  x3
In practice, the height of camera can be obtained by 
f y  x2  x3 ( x1  x2 x3 ) / ( x3  1) .
2
measurement in advance and cannot be changed after the (12)
mounting. As a result, the distance from obstacle to camera is 

v0  ( x1  x2 x3 ) / ( x3  1)
2

1149
Eventually, camera parameters fy, v0, α can be obtained by
using of B=tanα, and the camera calibration procedure is
completed.
To sum up, the linear calibration method based on
monocular vision consists of the following steps:
1. Input the height of camera h ,distances information
of three calibration points (d1, d2, d3) and
corresponding coordinates (v1, v2, v3);
2. Get the c=(C1, C2, C3)T in accordance with (6);
3. Calculate the x=(x1, x2, x3)T by using (10);
4. Solve (8) to get fy, v0, B;
Figure 2. The experimental scene.(The slalom pile cups, which stand for
5. Obtain the value of α by B=tanα; obstacles, are palced on the ground with some cetain distance between each
other.)
6. Substitute the camera parameters fy, v0, α and pixel
coordination of objective v into (3) to get h.
There are 42 test points in total, which are uniformly
This algorithm turns the camera calibration problem into distributed between 5m to 54m. The results of first 30 test
solving two linear equations by analyzing the projection points are listed in TABLE II.
relationship among the points on the image plane and in the
real world. On the one hand, it converts the nonlinear As shown in Table 2, the algorithm has a very good
problem into a linear problem; on the other hand, it only performance when the obstacles are near: most of the relative
needs 3 fixed points to complete the calibration, which errors are below 2% and the average relative error is 1.056%.
greatly reduces the computational complexity. In the The fluctuation is caused by random measurement errors of
following section, a series of experimental results will be pixel coordinates. Besides, in regard to the fact that two
shown to validate the accuracy of this ranging algorithm. points, No.17 and No.19, has larger errors than the other
ones, it may be due to greater errors occurred while
IV. EXPERIMENT AND ANALYSIS extracting pixel coordinates on the image plane.
Nevertheless, there is significant performance
To validate the proposed method, an experiment was
degradation when the objects are far away. For example, for
conducted with several targets placed in front of a camera
No.29, the absolute error is 0.52m where the test point was
which was mounted on a shelf. The images recorded by CCD
33m away from the camera. With the increase in distance
camera, as shown in Fig. 2, are stored in the computer. Then
between camera and obstacles, relative error was increased.
the height of camera, the pixel locations and actual distance
This is because along with the objects getting farther
of objects are acquired, and the distance was computed with
(assuming that the obstacles are always slanting beneath the
the proposed method.
camera), the effect of error of extracted vertical axis on the
Three fixed points are used for the calibration of the
image plane increases and it will naturally increases the
camera parameters. The height of camera from the ground is
ranging error. It is an inherent defect of monocular vision.
98.0 cm, and the other parameters are shown in TABLE I.
The calibration results are α=0.0745rad, fy=165.33 and To validate the robustness of the algorithm, an
v0=264.97. Then a set of test points are substituted into the experiment with three groups of calibration points was
algorithm to detect its measurement error. The estimated implemented.
distance is denoted by d΄, and then the absolute error and The default camera height is 98.0m. The results of
relative error can be expressed separately as e*=|d-d΄| and different calibration groups, such as camera parameters and
er=e*/d. In addition, the average relative error is eavr=∑er/N. average relative error, are listed in TABLE III.
Experimental data above show that when the calibration
TABLE I. PARAMETERS OF CALIBRATION POINTS points vary, the changes of calculated parameters and errors
are small, indicating that the algorithm is very robust.
Point No. v /pixel d /m
1 463 5.00 V. CONCLUSION
2 250 15.00 The camera parameters calibration method proposed in
3 this paper has two advantages: firstly, it solves nonlinear
203 25.00
problem by establishing two linear equations, which costs
small amount of computing and only needs three points to
complete the calibration. Secondly, it has a high accuracy in
distance measurement with a good robustness. The relative
error can be limited to 5% for the obstacles within

1150
TABLE II. RANGE ERROR 50 meters.
The experimental result shows that the method of
No. v /pixel d /m d / m e* / m er / % monocular vision for gaining obstacle depth information can
meet basic requirements in accuracy and timeliness in the
1 463 5.00 5.000 0.000 0.00 areas of vehicle assistant driving, computer vision and other
2 411 6.00 5.967 0.033 0.56 numerous fields. By combining it with multi-sensor
3 373 7.00 7.012 0.012 0.17 information fusion technology its performance and accuracy
can greatly enhanced.
4 344 8.00 7.969 0.031 0.39
5 321 9.00 9.009 0.009 0.10 REFERENCES
6 304 10.00 9.985 0.015 0.15 [1] M. N. A. Wahab, N. Sivadev, and K. Sundaraj, "Development of
monocular vision system for depth estimation in mobile robot - Robot
7 288 11.00 11.069 0.069 0.63 soccer," in 2011IEEE Conference on Sustainable Utilization and
8 275 12.00 12.105 0.105 0.87 Development in Engineering and Technology (STUDENT) , 2011,
pp. 36-41.
9 265 13.00 13.171 0.171 1.32 [2] Celik, K., Chung, S. J., Clausman, M., & Somani. “Monocular vision
10 257 14.00 14.027 0.027 0.19 SLAM for indoor aerial vehicles”, St. Louis, The 2009 IEEE/RSJ
International Conference on Intelligent Robots and Systems, 2009, pp.
11 250 15.00 15.000 0.000 0.00 1566–1573.
12 241 16.00 16.252 0.252 1.58 [3] Z. Zhang, Y. Han, Y. Zhou, M. Dai. “A novel absolute localization
estimation of a target with monocular vision”, Optik - Int. J. Light
13 237 17.00 16.959 0.041 0.24 Electron Opt. ,2012, pp.1218-1223.
14 231 18.00 18.059 0.059 0.33 [4] N. Snavely, S. M. Seitz, and R. Szeliski, “Photo tourism: exploring
photo collections in 3D,”ACM Transactions on Graphics, vol. 25,
15 228 19.00 18.754 0.245 1.29
no.3, Aug 2006
16 222 20.00 20.107 0.107 0.54 [5] R.B.Wang, B.Li, J.W.Chu,S.W.Ji. “Study on the method of measuring
17 216 21.00 21.671 0.671 3.20 the leading vehicle distance based on the on-board monocular
camera”, Journal of Highway and Transportation Research and
18 214 22.00 22.418 0.418 1.90 Development vol. 18, Dec. 2001, pp. 94-98.
19 211 23.00 23.496 0.496 2.16 [6] D. A. Forsyth, J. Ponce, “Computer vision: a modern approach (2nd
edition), Prentice Hall, 2011.
20 209 24.00 24.075 0.075 0.32
21 207 25.00 25.000 0.000 0.00
22 203 26.00 26.348 0.348 1.34
23 202 27.00 26.708 0.292 1.08
24 199 28.00 28.252 0.252 0.90
25 197 29.00 29.532 0.533 1.84
26 195 30.00 30.452 0.452 1.51
27 195 31.00 30.452 0.548 1.77
28 193 32.00 31.431 0.569 1.78
29 192 33.00 32.474 0.525 1.59
30 189 34.00 34.176 0.176 0.52

TABLE III. RANGING ERROR OF DIFFERENT CALIBRATION GROUPS

Group Calibration points Camera


eavr / %
No. (d / m, v) parameters

˄5.00, 462.67˅   0.067 rad ,


1 ˄14.00, 257.08˅ f y  1653.4, 0.996
˄24.00, 208.99˅ v0  251.66

˄5.00, 462.67˅   0.075rad ,


2 ˄15.00, 249.62˅ f y  1653.3, 1.056
˄25.00, 206.51˅ v0  264.97

˄7.00, 462.67˅   0.088rad ,


3 ˄14.00, 249.62˅ f y  1651.9, 1.010
˄24.00, 206.51˅ v0  286.64

1151

You might also like