Paper HoughTrans
Paper HoughTrans
net/publication/277299989
CITATIONS READS
0 801
1 author:
Mohamed Zahran
Benha University
24 PUBLICATIONS 93 CITATIONS
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
The Nile Delta - Contributed Book Project published by Springer International Publishing in 2017 View project
Integrating Modern Classifiers for Improved Building EXtraction from Aerial Imagery and LiDAR Data View project
All content following this page was uploaded by Mohamed Zahran on 27 May 2015.
M.I. ZAHRAN
Assistant Professor of Surveying and Photogrammetry
Faculty of Engineering at Shoubra, Benha University
ABSTRACT
1
1. INTRODUCTION
The initial work for finding straight lines is presented in [8]. All points on the same
line must satisfy the equation y mx c for some particular values m and c.
Suppose that the input image has been processed by a local edge detector to
produce a set of edge points, {(x,y)}, subsets of which are candidate points to lie
on straight lines in the image. For an edge point ( x1, y1 ) on a line L, the equation
y1 mx1 c gives an infinite number of solutions for m and c. These solutions
together form a line in m-c space, or parameter space. Each of the other edge
points that lie on the line L in the image space would yield another line in the
parameter space. These lines will intersect at the point (m,c) in the parameter
space which corresponds to the line L in the image space.
Ballard and Brown [3] suggested the following algorithm to detect lines using the
Hough method: 1. Quantize a parameter space between possible minimum and
maximum values for m and c. 2. Form a 2-D accumulator array of possible m
and c values A ( mmin : mmax , c min : c max ) initialized to zero. 3. For each edge point
(x,y) increment all points (m,c) in the accumulator array that satisfy the equation
c=y-mx 4. Local maxima (peaks) in the accumulator array indicate straight lines
the image space. Each detected line has a number of points equal to the counts
in the corresponding peak.
2
Duda and Hart [5] modified the original Hough technique. In their approach, a
straight line is parameterized in the image space as xcos +ysin =r
where and r are the parameters of the line in a polar representation (Fig.1).
This representation gives a range of from 0 o to 180 o degrees eliminating the
problem of singularity which might be introduced by large slopes in the y=mx+c
formulation. The transformation from the image space (x,y) to the parameter
space (r, ) can be implemented as suggested above. The only difference is
that image points are mapped into sinusoidal curves, instead of straight lines, in
the parameter space. Thus, if for a number of image points, the corresponding
sinusoidal curves in the parameter space intersect in a common point ( rj , j ),
then these points would lie on the straight line x cos j y sin j rj
The technique explained in Section 2.1 can be generalized to work for any
parameterized curve f(x,a) = 0 where x represents image points and a is the
parameter vector [3]. Suppose that the object to be detected has circular
boundaries. In this case the object can be parameterized by
( x a) 2 ( y b) 2 r 2 . For each boundary point belong to this circular object the
resultant loci of parameters is a circular cone. This can be seen from the circle
equation by fixing x and y and changing the values a, b and r. These circular
cones intersect at a common point in the parameter space. The coordinates of
this point are the parameters (a,b,c) of the circular object. The Hough Transform
can be implemented to detect circular objects in an image as follows: 1. Quantize
the parameter space between possible minimum and maximum values for a, b
and r. 2. Form a 3-D accumulator array of possible a, b and r values
A( amin : amax ,bmin :bmax ,rmin :rmax ) initialized to zero. 3. For each edge point (x,y)
increment all points (a,b,r), in the accumulator array, which satisfy the equation
( x a) 2 ( y b) 2 r 2 4. Local maxima (peaks) in the accumulator array
correspond to circles in the image space.
The computational cost using Hough Transform grows with the complexity of the
curve. This is because the amount of computations as well as the size of the
accumulator array increase exponentially as the number of parameters. To have
more efficient and computationally economic Hough transform, gradient direction
of edge points should be used. In this case each edge point can be expressed
as ( x, y, y / ) or ( x, y, ) where is the slope given as an angle. In the case of
detecting straight lines, y / tan = m . This leads to m y / and c y y / x
which is a fully determined case. In the case of detecting circular objects the
parameter locus is reduced from a circular cone to a straight line.
3
3. THE GENERALIZED HOUGH TRANSFORM (GHT)
In Section 2 it is shown how to use the HT technique to find straight lines as well
as parameterized shapes. Here the interest is to generalize the technique to
detect arbitrary shapes which can not be described analytically. Merlin and
Farber [13] were the first who showed how the HT could be generalized to detect
arbitrary shapes at a given orientation and a given scale. They developed their
algorithm without making use of gradient information of the boundary points of
the shape.
Ballard [2] extended the work of Merlin and Farber to formulate more efficient
GHT to detect arbitrary shapes by utilizing gradient information. A general shape
is defined as: F = {C,S, } where C = (xC,yC) is a reference origin for the shape,
is the shape orientation, and S = (Sx,Sy) are two orthogonal scale factors. This
definition is simplified by considering S as a scalar which lead to a four-
dimensional subspace. In developing GHT a tabular representation, called R-
table, for the shape is utilized. Each boundary point belong to the shape is
stored in this table as a vector relative to an arbitrary reference point, i.e., a
distance r, and a direction , of the line connecting the boundary point and the
reference point. The resulted list of vectors is organized so that they are indexed
by the gradient direction of the boundary points. Accordingly, when applying the
GHT each image point is only compared with a subset of R-table entries which
have similar edge direction. Fig.2 shows shape representation for R-table and
Table 1 illustrates the form of R-table.
4
Table 1. The form of the R-table
R-table for certain shape can easily be constructed by examining its boundary
points. A reference point c for the shape is selected first. Then, for each
boundary point x, compute r = c - x and the gradient direction (x). Store the
vector r as a function of (x). For a shape that has known rotation and scale, the
reference point coordinates (xC,yC) are the only parameters. Therefore, an image
point p(x,y) with a gradient direction constraints the locus of the reference
point to be at { x rp ()cos[ p ()], y rp ()sin[ p ()].
initialized to zero. 3. For each edge point, compute ( ) , calculate the possible
reference points for each table entry for ( ) [ xc x r()cos () ,
y c y r()sin () ], and then increment the accumulator array
A( xc , y c ): A( xc , y c ) 1. 4. Possible locations for the shape are given by
maxima in array A.
are computed as :
5
matching process. Shapes are the most complex primitives to be used in feature-
based matching. Thus, unique feature representation as well as robust matching
results can be expected [7], [18], [20]. Moreover, the more complex the matching
primitives the smaller is the number of the possible candidates and the fewer
are the chances of having ambiguities in the matching process. An important
goal for this work is to have a matching system in which matching results are not
so sensitive to errors in the segmentation process or to partial variations
between the corresponding shapes in two conjugate images. These problems
are challenging to many shape matching methods.
Non-parameterized arbitrary shapes are the type of shapes that are used in the
proposed matching approach. Therefore the principles of Generalized Hough
Transform are utilized in the development of this approach. However the GHT
is required to be modified in order to serve the goal of matching overlapping
images. As described in section 3, GHT is used to detect an instance of a shape
in an image domain. This is accomplished by matching the shape points against
the qualified edge points in the image. This is less complicated than matching
the whole content in overlapping images. In the later case we deal with too
many arbitrary shapes. And it is expected that some of these shapes do have
similar geometry. Therefore matching each shape in one image against edge
points in the other image is not efficient in this case. More efficient approach is
to match shapes in the two images. And the interrelationships among these
shapes are utilized to achieve the consistency of the matching results.
6
5. At last, a fine to coarse technique can be applied to mark additional edges.
After edge tracking, edge segments are numbered and a record for each
segment is maintained, including the segment length and the coordinates and
gradient orientation of each segment point.
apply HoughLines()
4.1.3 Formation of R-tables
As explained in section 3, R-table lists each boundary point of the shape to be
represented as a vector relative to an arbitrary reference point, i.e., a distance, r,
and a direction , of the line from the reference point to the boundary point. The
resulting list of points is arranged so that entries are indexed by the gradient
orientation of the boundary points.
A R-table is formed for each of the extracted edge segments in one image of
the stereo-pair, say the left image. The centroid of each segment can be taken
as a reference point. The centroid coordinates (xC,yC) can be calculated from the
coordinates of the segment points. Therefore, the vector from the centroid to
each boundary point j is of a distance rj [( x j xC ) 2 ( y j y C ) 2 ]1/ 2 and a
direction j tan 1[( y j y C ) / ( x j xC )] .
7
point. Utilizing these data, the matching process, for each edge segment in the
left image can be implemented as follows:
1. Compute an approximate location for the displaced centroid of the left edge
segment in the right image, using the knowledge about the overlap and image
resolution.
2. To find the corresponding segment in the right image all the right edge
segments whose centroids are located within a specified search window in the
right image are considered to be candidates. The size of the search window can
be computed using the elevation range of object space [15].
3. The matching process is applied for the left segment against each of the
matching candidates in the right image as follows:
a. Get the R-table for the left segment.
b. For each of the matching candidates in the right image form two 2-D array of
size m by n where m is the length of the left edge segment to be matched and n
is the length of the matching candidate in the right image. For each edge point
( xrj , y rj ) along the matching candidate and for each R-table entry in the range
between ( ) and ( j t) , where t is an angular tolerance accounting for
j
8
detected peak during the matching process. Using these points, common
subsegments of each two matched edge segments can be found. This can be
carried out in two steps. First, contiguous tracked points along each of the two
matched pair of segments are connected so that two subsegments are formed.
Then the common parts of these two subsegments are extracted based on the
knowledge of the correspondence between the tracked points. This procedure
may not lead to reliable results when matching straight lines of different lengths.
9
matching scheme, segment C will match each part individually. And the centers
of the three resulting peaks will have the same coordinates. This observation can
be utilized to improve the results of the segmentation process performed before
applying the matching algorithm. For instance, if the C1, C2, and C3 are close
enough to each other, they can be grouped together.
On the other hand, if an edge segment in the right image is broken into
subsegments in the left image the case will be little different. By applying the
matching scheme, each of these subsegments match the right segment. More
importantly is that the coordinate difference between each two subsegment
centroids in the left image is equal to the difference between corresponding
displaced centroids in the right image. Again, these subsegments can be
grouped in one segment in case they are separated by few pixels.
It is worth mentioning that conjugate reference points in the two sets deviate
from the cluster center depending on their disparity value. Larger disparities lead
to larger deviations. Therefore, before performing the consistency check. It is
important to eliminate the effect of the disparity especially for the reference
points of large disparity values. The knowledge about disparity values can be
obtained from the corresponding tracked common points.
10
xc x r() S cos [() + ] (5)
o
( xC x) 2 / So r 2 ()cos 2 [() + ]
2
(7)
( y C y) 2 / So r 2 ()sin2 [() + ]
2
(8)
( xC x) 2 ( y C y) 2 r 2 ()So
2
(9)
In Equation (9) the values of r() , x and y are known whereas xC and y C are
unknowns. Thus the problem is to determine which location ( xC , y C ) in the
accumulator array A ( x : x ,y :y ) satisfy this equation. This can be
C min C max C min C max
11
6. A PROPOSED SCALE INVARIANT GHT
12
Equations (10) and (11) can be rewritten as:
In Equation (14) x C and y C are unknowns and the task is to determine which
position (xC,yC) in the accumulator array satisfy this equation. This can be
resolved in a procedure similar to the one described in Section 5. We substitute
the coordinates (xC,yC) of each possible cell in the accumulator array in Equation
(14). At the locations where ( y C y) / ( xC x) is equal to tan [() + o ] the
accumulator array is incremented by one. Possible locations for the shape are
given by the maxima in the accumulator array. The concept can be displayed
graphically in Fig.5. Fig.5a shows the shape S with its four boundary points.
13
Fig.5b depicts how to compute the reference point by the boundary points of the
scaled shape. At each point of the scaled shape, lines parallel to the vectors r1
through r4 are drawn. The reference point of the scaled shape is the point of
intersection of these lines.
Again this procedure requires large amount of computations and does not lead
necessarily to a well-defined solution. To reduce the computational cost
dramatically and strengthen the solution of the problem, an additional constraint
is introduced. It is the invariance of the angle for each boundary point of the
shape with scale change. Thus for each boundary point of the scaled shape, the
cells of the accumulator array which satisfy Eqn.14 are incremented if they fulfill
this constraint.
Fig. 6. Patch S1; a 250x250-pixel patch (left) Fig. 7. Patch S1; a 250x250-pixel patch (right)
The edge segments are extracted by applying Canny’s edge detector and the
edge tracking algorithm to the patches S1 and S2 respectively. For each edge
segment, the coordinates and the gradient orientation of its points are recorded.
14
The centroid of each edge segment in each of the two image patches is
computed by averaging the coordinates of segment points. A R-table is
constructed for each edge segment in the patch S1 based on the computed
centroid.
Patches S1 and S2 are matched using the procedure described in Section 4.1.4.
The threshold for the matching score is selected as 0.5. This means that at least
50% of the points of each of two matched edge segments are contributing to the
detected peak. A consistency check is performed according to the procedure
described in Section 4.3. The reference points whose disparities are significantly
different from the mean disparity are adjusted for the disparity difference. As a
result of the consistency check, a peak in the parameter space is formed with a
computed dispersion of 1.5 pixels. Fig.8 and Fig.9 display the matched segments
in patches S1 and S2 respectively.
Fig. 8. Matched edge segments in patch S1 Fig. 9. Matched edge segments in patch S2
The dispersion of the associated peak is computed for each matched pair of
edge segments. It is found that they are almost equal to zero. This means that
there is no spread in the detected clusters in the parameter space.
15
The conjugate points along each pair of the matched edge segments in the test
pair are extracted using the procedure explained in 4.2. The locations of these
points in patches S1 and S2 are displayed in Fig.10 and Fig.11 respectively. The
disparity values are computed for the extracted conjugate points along each
matched pair of edge segments. It is found that these values are the same; i.e.,
the figural continuity is preserved after applying the matching procedure.
Fig.10. Location of conjugate points in patch S1 Fig.11. Location of conjugate points in patch S2
8. CONCLUSIONS
16
The proposed technique is developed theoretically and then implemented as a
software prototype in order to assess its feasibility. The results are good and
robust. The ambiguity in the matching results is minimal. It is worth pointing that
the proposed matching technique becomes less efficient if there is large disparity
differences in the image space. This is because points deviate from the Hough
peak depending on their disparity values.
REFERENCES
[5] Duda, R.D., Hart, P.E., “Use of The Hough Transform to Detect Lines and
Curves in Pictures,” Communication of the ACM, Vol. 15, No.1, 11-15, (1972).
[6] Haralic, R. M. and Shapiro, L. G., “Computer and Robot Vision,” Addison-
Wesley Publishing Company, Inc, (1993).
[7] Hellwich, O. and Faig W., “Graph-Based Matching of Stereo Image Features,”
Proceeding of International Society of Photogrammetry and Remote sensing,
Commission 3, Washington, D.C, USA, 307-317, (1992).
[8] Hough, P.V.C., “Method and Means for Recognizing Complex Patterns,” U.S.
Patent No. 3069654, Dec 18, (1962).
[9] Illingworth, J. and Kittler, J., “A Survey of The Hough Transform,” Computer
Vision, Graphics and Image Processing, Vol.44, PP 87-116, (1988).
[10] Leavers, V. F., Shape Detection in Computer Vision Using the Hough
Transform, Spring-Verlag, New York/Berlin, (1993).
17
[12] Marr, D. and Hildreth, E., “Theory of Edge Detection,” Proceedings of Royal
Society of London, Vol. 207, pp 187-217, (1980).
[13] Merlin, P.M. and Farber, D.J., “A Parallel Mechanism for Detecting Curves in
Pictures,” IEEE on Computers, C24, pp 96-98, (1975).
[15] Schenk, T. and Li, J. C. and Toth, C., “Towards an Autonomous System for
Orienting Digital Stereopairs,” Photogrammetric Engineering and Remote
Sensing, Vol.57, No.8, August, pp 1075-1064, (1991).
[16] Van Veen, T. M. and Groen, F. C. A., “Discretization Errors in The Hough
Transform,” Pattern Recognition, Vol. 14, pp 137-145, (1981).
18