Generalizing the Hough transform to detect arbitrary shapes 113
Oornoin of
(x,y)
Fig. 3. Using convolution templates to compensate for
errors.
M"- 1. This is because the equation of the curve can be
used to determine the last parameter. The use of
gradient directional information saves the cost of
another parameter making the total effort propor-
tional to M"-2, for m >_ 2.
2.2
Compensating for errors
A problem arises in detecting maxima in the array
A(a). Many sources of error effect the computation of
the parameter vector a so that in general many array
locations in the vicinity of the ideal point a are
incremented instead of the point itself. One way of
handling this problem is to use a formal error model on
the incrementation step. This model would specify a
set of nearby points instead of a single point. Sha-
piro tls-ls) has done extensive work on this subject.
Another solution to this problem is to replace uncom-
pensated accumulator values by a function of the
values themselves and nearby points after the in-
crementation step. The effect of this operation is to
smooth the accumulator array. We show that, under
the assumption of isotropic errors, these methods are
equivalent.
Returning to the initial example of detecting circles,
the smoothing of the accumulator array is almost
equivalent to the change in the incrementing pro-
cedure we would use to allow for uncertainties in the
gradient direction q~ and the radius r. If we recognized
these uncertainties as:
4~(x) + A~
r +_ Ar(r)
we would increment all values of a which fall within the
shaded band of Fig. 3. We let Ar increase with r so that
uncertainties are counted on a percentage basis. Figure
3 shows the two-dimensional analog of the general
three-dimensional case.
Suppose we approximate this procedure by incre-
menting all values of a which fall inside the square
domain centered about the nominal center shown in
Fig. 3, according to some point spread function h. After
the first contributing pixel which increments center ao
has been taken into account, the new accumulator
array contents A will be given by
A(a) = h(a- ao) (2)
where a =
(al,a2,r)
and ao =
(alo, a2o, ro).
If we in-
clude all the contributing pixels for that center,
denoted by C, the accumulator is
A(a) = C(ao)h(a- ao). (3)
Finally for all incremented centers, we sum over
ao:
A(a)--- ~ C(a0)h(a-ao). (4)
ao
But C(ao) = A(ao), so that
A(a) = ~ A(ao)h(a-ao)
at~
= A*h
- A,(a). (5)
Thus within the approximation of letting the square
represent the shaded band shown in Fig. 3, the
smoothing procedure is equivalent to an accom-
modation for uncertainties in the gradient direction
and radius.
3. AN EXAMPLE: ELLIPSES
The description of the algorithm in Section 2.1 is
very terse and its implementation often requires con-
siderable algebraic manipulation. We use the example
of finding ellipses to show the kinds of calculation
which must be done. Ellipses are an important exam-
ple, as circles, which are a ubiquitous part of many
everyday objects, appear as ellipses when viewed from
a distant, oblique angle.
We use the center of the ellipse as a reference point and
assume that it is centered at
Xo, Yo
with major and
minor diameters a and b. For the moment, we will
assume that the ellipse is oriented with its major axis
parallel to the x-axis. Later we will relax this require-
ment by introducing an additional parameter for
arbitrary orientations. For the moment, assume a and
b are fixed. Then the equation of the ellipse is :
(X-- XO) 2 (y--yo) 2
a2 + bz
- 1. (6)
~x
Fig. 4. Parametrization of an ellipse with major axis parallel
to x-axis.