to a single or to several border lines. In those cases,
when the mask is applied to a new edge pixel, the
already labelled pixels below are checked by using
the vertically mirrored mask. If there are many pixels
with a label not equal to the label of the mask’s central
pixel, the label of the central pixel changes to the one
of the majority of the pixels in the mask. The 4th and
5th rows in Fig. 1 show an example of this process
with steps a, b and c. Final images with connected
and labelled edge pixels are denoted by L
i
(x,y), but
these still contain potential border lines. To be con-
sidered sidewalk borders, detected lines must satisfy
the following three requirements:
(1) Connected edge pixels must have a minimum
length (MinEL) covering at least 80 vertical positions
(MinEL 1TL or MinEL 2TL, depending on the line
starting on 1TL or on 2TL, see Fig. 1, 2nd image from
top). Shorter series are removed.
(2) Connected edge pixels must be almost lin-
ear, i.e., with correlaton r > 0.9, with a slope |b|
between 0.5 and 10. The slope also provides infor-
mation about the sidewalk’s width: the higher the
slope, the narrower the sidewalk. In order to speed
up the correlation/slope process, only eight equidis-
tant points of each potential line are processed. The
correlation r of edge pixels with the same label is
given by r = σ
2
xy
/
q
σ
2
x
· σ
2
y
, where σ
2
xy
is the covari-
ance σ
2
xy
=
∑
xy/n− (
∑
x·
∑
y)/n
2
and σ
2
x
and σ
2
y
are
the variances of x and y
σ
2
x
=
∑
x
2
n
−
∑
x
n
2
;σ
2
y
=
∑
y
2
n
−
∑
y
n
2
. (1)
The regression line is given by L = a+ bx, with
b =
∑
x·
∑
y− n
∑
xy
(
∑
x)
2
− n
∑
x
2
;a =
∑
x·
∑
xy−
∑
y·
∑
x
2
(
∑
x)
2
− n
∑
x
2
. (2)
(3) Occasionally, more than two lines remain as
potential sidewalk borders, or none at all. Depend-
ing on the number of lines n
l
, the following is done:
(i) If no lines are found, n
l
= 0, the last two borders
found in a previous frame will be used. (ii) If a sin-
gle line is found, n
l
= 1, the second line will be au-
tomatically generated, symmetrically with respect to
the vertical line that passes through the intersection
of the line found and the horizontal line through the
vanishing point. The latter is updated dynamically for
each new frame, as explained below. (iii) If two lines
are found, n
l
= 2, they are accepted as sidewalk bor-
ders, but with the following exception: If the signs of
the slopes of the two lines are not different, this means
that we do not have the right lines. The outermost one
is ignored, the innermost one is used, and a new line
is generated as in case n
l
= 1. Here, innermost means
closest to the center of the frame and outermost clos-
est to the left or right frame borders. (iv) In the case
of more lines, n
l
> 2, the most symmetrical and inner
pair of lines is selected.
Above, the vanishing point is used to generate
symmetrical line pairs. At the start of a sequence of
frames, or when no acceptable sidewalk borders can
be detected, the height of the vanishing point will be
initialized at 3/4 of the frame height. Then, when
two correct sidewalk borders are found, the vanish-
ing point is determined by the intersection of the two
borders, and the point is dynamically updated by av-
eraging the points of the previous frame and the new
frame.
After obtaining two valid sidewalk borders, the
obstacle detection window (ODW) is defined for de-
tecting and locating possible obstacles. This window
has predefined upper and a lower limits with a height
of N
v,ODW
= 100 pixels (v is vertical); see Section 2.
The left and right limits are defined by taking 80% of
the distance between the two borders found at the up-
per limit, which gives N
h,ODW
pixels (h is horizontal).
3 OBSTACLE DETECTION AND
AVOIDANCE
For obstacle detection, two different methods are ap-
plied to the ODW. The first one counts variations of
gray values, i.e., local maxima and minima, on each
horizontal line inside the ODW. Then, outliers are re-
duced by averaging counted variations over groups of
lines, and variations over these groups are combined
into a single value which indicates whether the frame
has a possible obstacle or not. Final confirmation is
obtained by combining the results of a few subsequent
frames. The second method is based on irregulari-
ties in vertical and horizontal histograms of the binary
edge image I
i
. An obstacle can lead to two differ-
ent signatures: if the pavement is smooth, an obstacle
may appear as a local excess of edge points, but if
it has a strong texture there will be a huge amount
of edge points and an obstacle may appear as a local
deficiency (lack or gap) of edge points. The second
method is used to confirm the result of the first one,
but it also serves to detect the size and position of an
obstacle in order to guide the user away from it.
3.1 Local Maxima and Minima
(a) A small lowpass filter (averaging block filter of
size 3x3; LP(x, y)) is applied twice to the graylevel
ODW of frame i (F
ODW,i
), so high frequencies are
OBSTACLE DETECTION AND AVOIDANCE ON SIDEWALKS
237