Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

ROBUST LINE DETECTION USING A WEIGHTED MSE ESTIMATOR

Guido M. Schtrster Aggelos K. Katsaggelos

Abteilung Elektrotechnik Department of Electrical and Computer Engineering


Hochschule Rapperswil, Switzerland Northwestern University, Evanston, Illinois, USA
guido.schuster@hsr.ch aggk@ece.nwu.edu

ABSTRACT stage, it camot he corrected in the line detection stage. Further-


more, most edge detection algoritbms require one or more thresh-
In this paper we introduce a novel line detection algorithm based olds for selecting which points belong to edges and which not.
on a weighted minimum mean square error (MSE) formulation. Whenever a threshold is required, finding a rohust value which
This algorithm has been developed to enable an autonomous robot works under all circumstances is a major problem which typically
to follow a white line drawn on the floor, hut is general in nature can not he solved in a satisfactory way. The proposed algorithm
and widely applicable to line detection problems. does not have these problems; instead it finds the parameters of
Traditional approaches to line detections consist oftwo stages, a line model directly as the optimal solution of a weighted MSE
an edge detection stage and a line detection stage using the edge problem.
detection result. There are several problems with this approach. The paper is organized as follows: In section 2 we introduce
First. the initial edge detection stage is sensitive to noise. Sec- notation and assumptions necessary for the remainder of the pa-
ond, the second stage does not use all the information available in per. In section 3 we introduce a parametric model for the line. In
the image and therefore incorrect decisions made by the first stage section 4 we derive the weighted MSE solution to the line detec-
cannot he corrected in the second stage. tion problem. In section 5 we propose the weighting matrix tbat
The proposed algorithm achieves its robustness by operating is meaningful in our application. In section 6 we show results of
in one step, using all pixels of the image (correctly weighted) and the proposed algorithm for an autonomous robot application and
not using any thresholds. The detected line is the solution of a section 7 concludes the paper.
weighted MSE problem. The follow-ing h e questions are an-
swered in thc paper: (I) what mathematical model should he used
2. NOTATION AND ASSUMPTIONS
for the line'? (11) how should the weighted MSE problem he set
up so that the optimal solution results in the parameters of the line
The fundamental assumption in this paper is that there is only one
model? And (111). how should the pixels in the image he weighted
dom~iantline in the image. Smce the algorithm is based on a
such that a weighted MSE optimal solution results in a robust line
weighted MSE approach, the scheme would select a line as the
detection? Experimental results demonstrate the performance of
solution that is the weighted average ofthe multiple lines, which
the algorithm in noiselcss and noisy conditions.
would he incorrect. This does not mean that no other short line
segment is allowed, such a the leg of a chair or a pattern in the
1. INTRODUCTION floor, it simply means that the line we are trying to detect is the
longest and therefore, among all other candidate lines, it has the
The goal o f a line detection algorithm is to find in a given gayscale most points in the original image. A second assumption is that
image I a particular line of interest, as shown for example in white the skeleton of the line we try to detect can he expressed as c =
in fig. 1. Note that the line is not ofone pixel width and in fact the f(r), where c and T are the column and row coordinates of the
width is changing with distance and perspective. We are therefore point and f(.) will he defined in the next section. Although, a
interested in the line in the middle ofthe white line as a simplified circle for example, does not satisfy this assumption, it is however
descriptor. reasonable since we look at the line from the perspective ofa robot
One powerful approach for straight line detection is the Hough which is very close to the floor. In facf points that are closer to
transform and its variants [I]. When a curved line needs to he the camera are more important since these are the points the robot
detected, as is the case in this paper, then the Hough transfonn needs to follow hi. We will use this fact in section 5 to make the
becomes quickly so high dimensional that it is not feasible. algorith pay more attention to these points. We further assume
that the grayscale image I is of dvnensions R x C, where R is
Another approach is to use an edge image E to find the line,
the maximum number of rows and C the maximum number of
since the line creates two strong edges as can be seen, for e m -
columns.
ple. in fig. 2 which shows the squared norm of the gradient of a
Gaussian (u=l)lowpass filtered image of fig. I . It is common to
fust h i d all the edges in the image, using an edge detection algo- 3. LINE MODEL
rithm and then analyze the edge image to find the particular line.
The main problems with Uus approach that line detection al- The main purpose ofthe line model is to introduce the continuity
gorithms are sensitive to noise and the detection ofthe line is now and smoothness of a real line in the detection process. Further-
a two step process. If an error is made during the edge detection more. such a mathematical descriDtion of the line is n more useful

0-7803-7750-8/03/$17.00 02003 IEEE I - 293

Authorized licensed use limited to: Kelvin Smith Library @ CASE. Downloaded on November 11, 2008 at 21:26 from IEEE Xplore. Restrictions apply.
abstraction for a higher level vision algorithm than a simple pixel in the unage. Since clearly the line pixels are not hmwn in ad-
based description. As discussed in section 2 we assume that the vance (they are the objective of the estimation process). the line
middle ofthe line we try to detect satisfies this equation: c = J ( T ) . equation is applied to all pixels in the iniage after they are appro-
To be exact. we assume that the hnction J ( . ) is a low order poly- priately weighted. Pixels that have a high intensity value are more
nomial, that is. c = 21 * TO + x2 * TO-' + +
. . . xo--l * r zo, + likely to belong to the line, hence their weights should be high (in
where zi are the coefficients and o is the order of the polynomial. our experiments we used white tape to indicate the line shown in
It is important lo note that we have also investigated other line fig. 1). In other words, the weight for a pixel (vi c;) should be ~

models. Again. they all introduced some form of continuity and proportional to its intensity value I(ri, ci).
smoothness since these are features of real lines on a floor. One Furthermore. in the edge image E, which is in our case the
model which is more general than the one used above is that of a squared norm of the gradient of a Gaussian (U = 1) lowpass fil-
Hemitc spline, where the column c and the row r are both poly- tered image, high values belong to pixels that are on edges. Clearly
nomial functions of a parameter s. While this model allows for the line creates two edges, but the weighted MSE solution results
more complex lines, the resulting optimi7ation procedure is more in the middle in the horizontal direction or these two edges, since
complex and will not be discussed in tlus paper. at this p i n t the average squared error is kept the smallest. Hence
Another way to enforce continuity and smoothness of a line is the weight of a pixel at ( ~ iG, ) should also be proportional to the
by following a snake based approach [Z] and its more recent vari- value in the edge image E(ri, ci).
ants. such as deformable templates [3]. These approaches have the In our pnrticular application, we are more interested in the part
problem that they are not globally optimal but depend 011 the ini- of the line closer to the camera than the one in the far distance.
tial conditions. As we will show "1 section 4 the proposed solution Hence we also weight the importance of the error proportionally to
does not require any initial conditions and h d s in fact the globally the closeness to the camera. To make sure that all these weights are
optimal solution. of tl!e same magnitude. we normalize the intensity image. denoted
by I, such that its standard deviation is 1 arid its ni@inium value
4. WEIGHTED MSE SOLUTION is 0. We do the same for the edge image and call it E. One row i
of the set of equations W y = W A X(there are N = RC rows of
Now that the line model is decided its parameters need to be es- them) Ims the form: wi t ci = 70; * (21 * rp -t22 * rp-' + + ...
timated. We use the wcll known concept of MSE estimation via xo--l * r i + x , ) _ w h c r e w i = i ( r i , c i ) t E ( r i , c i ) t r i J R . N o t e
the generalized inverse (also known as pseudo-inverso or Moore- that the error for a particular parameter vector i is now equal to
Penrose-inverse) of a matrix A t which we denote by ( A t ) ' . As- e * ( ? ) = wi * (c,- (21 *rp+ i 2 try-' -t . . . + i , - l * ri + i o ) ) ,
sume that we have the following equation y = Ax where y is which illustrates the idea behind weighting the error of the pixels
an N x 1 vector, x = [z1,z2, , . . ,zo--l,x,IT is the h e model differently.
parameter vector of dimensions o x 1 and A is a matrix of di- In short. this setup is such that the solution will follow the
mensions N x 0. Theii the MSE solution to this problem is: edges and the bright areas closer to the camera as well as the order
i = (ATA)'ATy. In other words the total quadratic error e' = of the line model allows. Note that for OUT application it is quite
(y - A i ) T ( y- A i ) is as small as possible for the selected i. meaningful to weight heavier the pixels closer to the camera. This
Since we would Like to he able to weight the individual com- clearly depends on the particular applicatioR though it shows a
ponents of the quadratic error. we introduce an invertible diagonal nice feature of the algorithm which is the ability to include such
weight matrix 14' ofdimensions N x N . Hence we are interested in prior knowledge into the formulation of the problem. For example
the solution that m h h i z e s the following weighted quadratic error in a tracking application, where the previous location of the line is
eT, = ( y - ~ i ) T ~ , ~ - =T (W~( (~ y
- A- ~~) t) ~ ) ) . one can use a location weighting function that favors solu-
) ( W ( ~ - A ? known,
Note that this is an equivalent problem lo minimizing the mean tions that are close to where a motion nmdel would have predicted
squared error of the following equation: y, = A,x,. where them.
U,, = W U ,A, = WA and x W is the " n e t e r vector that
needs to be estimated. The solution to tlus problem is now :e, = 6. EXPERIMENTAL RESULTS
~ I
..)'ATV,.,= (ATWTWAI'ATWTCV~.
(4TA..", I"- ~

Now that we have a line model and a method for finding the Figure 1 shows the image acquired by the on-board camera. Only
optimal solution lo a weighted MSE problem, we need to set up the rows 15 through 60 are processedby the proposed algorithm, since
problem. In other words we need to d e h e the matrix A. which from the mounting of the camera this is where we expect the line
contains the line model, the vector y which reflects the desired to be.
values atid the weighting matrix W which reflects the importance We have performed a series of experiments where we visually
of each pixel in the image. 'Tlus is done in the next section. compare the perfomlance of an automatic Canny edge detector [4]
(the first step of a two step line detection process) and our proposed
5. WEIGHTING SELECTION algorithm First we show the perfomlance in a noise-free environ-
ment, which represents hnages taken with suficient ambient light
The basic idea of this algorithm is to use all available pixels for and theii we show results when the ambient light is low and hence
detecting a line that is given by a linc model. In other words, no tbe images are noisy. Polynomials ofvarious orders were tested for
pixels are eliminated dpriori but all ofthem are involved in hiding describing the line. For the example of fig. 1 orders o = 2 , . . . ,5
the proper estimate. Clearly some pixels are more important than gave comparable results. The results reported in this section were
others and hence we use a weighted MSE scheme discussed in achieved using an order o = 3.
section 4 for estimating the parameters. Figure 3 shows the result of the automatic Canny edge detec-
+
The line equation used is c = TI * ro 2 2 * TO-^ . . . + + tor implemented in the MATLAB image processing toolbox. Fig-
zo-l* v i -zo.This equation must hold for all line pixels (r.c) ure 4 shows the same image processed hy the proposed algnrithni.

I - 291

Authorized licensed use limited to: Kelvin Smith Library @ CASE. Downloaded on November 11, 2008 at 21:26 from IEEE Xplore. Restrictions apply.
Clearly the result is at least as good as the Canny edge detector and
in addition the proposed algorithm results in a parametric descrip-
tion of the line and not only in an edge image. Note that the pix-
els closer to the camera (bottom of the image) are better matched
than the ones Funher away, which is tbe intention of the row-based
weighting. Furthermore, in the MATLAB implementation of both
algorithms our algorithm is about an order ofmagnitude faster.
For the next experiment we added zero mean additive w h t e
Gaussian noise (AWGN) to the image resulting in a signal to noise
ratio (SNR) of OdB, simulating a low light environment. The re-
sulting grayscale image can be seen in fig. 5 , the squared norm of
the g d i e n t o f a Gaussian (U : 1) lowpass filtered version of this
noisy image can he seen in fig. 6 and fig.7 shows the result ofthe
Canny edge detector. Figure 8 shows the image of fig. 5 processed
by die proposed algorithm. Clearly this is still a g o d result even
though the SNR is so low that the Canny edge detector fails.

7. SUMMARY AND CONCLUSIONS


Fig. I. Original grayscale image
In this paper we have presented a novel robust line detection algo-
rithm based on a weighted MSE formulation of Ihe line detection
problem. One of the powerful features of the algorithm is that it
does not require any thresholds, but finds a solution ils the optimal
tradeoff hetween many different sources of infomiation and con-
straints. The main constraint is the line mcdel which represents
our prior howledge about the continuity and smoothness of the
line we are tryllig to detect. The information Souses are the inten-
sity of the image and the edge image (but other ones can be added
easily, dependlng on the particular application). The fusion of this
information is achieved via a weighted MSE formulation. In ad-
dition, this liamework allows for certain information to he rmsted
more than other, so, for example, we weight the information closer
to the camera heavier than the information further away. The ex-
periniental results show that the proposed algorithm i s quite robust
and significantly faster than the Canny edge detector. Especially in
a noisy environment the proposed algorithm can still reliably fmd
the line. In comparison, at tlus SNR the automatic Canny edge
detector CaMOt detect the edges anymore. Even though the algo.
rithm was developed for the line detection stage of an autonomous
robot. the scheme is quite general in nature and be applied Fig. 2. Squared norm of the gradient of a Gaussian (0= I) low-
many similar visual detection problems. pass filtered image shown in fig. 1

8. REFERENCES

I. Illingworth and J. Kittler, “ A survey of the Hough trans-


form,” Computer b i o n , Graphics aiidIiiiage Processiiig, vol.
44, pp. 87-1 16. 1988.
M.Kass. A. Witkin, and D. lerzopoulos, “Snakes: Active
contour models,” Iirlernoliorral Jnuwal of Cnmpirler Ksioi~,
vol. 1,pp. 321-331.1987.
A.K. Jain, Y. Zhong, and S. Lakshmanan, “Object matching
using deformable templates;’ IEEE Transactions on Poitern
Aiialvsis and Machine Iiitelligcace, \,ol. 18, no. 3, pp. 261-
278, 1996.
[41 J. Canny, “A computational approach to edge detection,” IEEE
Tramsactions on Potteni Analysis and Machine Iiirelligeirce,
vol. 8. no. 6 , November 1986.

Fig. 3. Canny edge detector processing the image shown 111 fig. 1

I - 295

Authorized licensed use limited to: Kelvin Smith Library @ CASE. Downloaded on November 11, 2008 at 21:26 from IEEE Xplore. Restrictions apply.
(" ?(I 3,) 40 !e 8') 1" ""

Fig. 4. Detected line in fig. 1 using the proposed algorithm

Fig. I. Canny edge detector processbig the image shown "I fig.5

Fig..5. Original grayscale image with AWGN @ SNR=OdB

Fig. 8. Detected line in fig. 5 using the pmposed algorithm

Fig. 6. Squared norm of the gtadient of a Gaussian (a = 1)low-


pass filtered image shown in fig. 5

I - 296

Authorized licensed use limited to: Kelvin Smith Library @ CASE. Downloaded on November 11, 2008 at 21:26 from IEEE Xplore. Restrictions apply.

You might also like