Brief Description
The Hough transform is a technique which can be used to isolate features of a particular shape within an image. Because it requires that the desired features be specified in some parametric form, the classical Hough transform is most commonly used for the detection of regular curves such as lines, circles, ellipses, etc. A generalized Hough transform can be employed in applications where a simple analytic description of a feature(s) is not possible. Due to the computational complexity of the generalized Hough algorithm, we restrict the main focus of this discussion to the classical Hough transform. Despite its domain restrictions, the classical Hough transform (hereafter referred to without the classical prefix) retains many applications, as most manufactured parts (and many anatomical parts investigated in medical imagery) contain feature boundaries which can be described by regular curves. The main advantage of the Hough transform technique is that it is tolerant of gaps in feature boundary descriptions and is relatively unaffected by image noise.
How It Works
The Hough technique is particularly useful for computing a global description of a feature(s) (where the number of solution classes need not be known a priori), given (possibly noisy) local measurements. The motivating idea behind the Hough technique for line detection is that each input measurement (e.g. coordinate point) indicates its contribution to a globally consistent solution (e.g. the physical line which gave rise to that image point).
As a simple example, consider the common problem of fitting a set of line segments to a set of discrete image points (e.g. pixel locations output from an edge detector). Figure 1 shows some possible solutions to this problem. Here the lack of a priori knowledge about the number of desired line segments (and the ambiguity about what constitutes a line segment) render this problem under-constrained.
Figure
We can analytically describe a line segment in a number of forms. However, a convenient equation for describing a set of lines uses parametric or normal notion:
where
Figure 2 Parametric description of a straight line.
In an image analysis context, the coordinates of the point(s) of edge segments (i.e.
The transform is implemented by quantizing the Hough parameter space into finite intervals or accumulator cells. As the algorithm runs, each
We can use this same procedure to detect other features with analytical descriptions. For instance, in the case of circles, the parametric equation is
where
Guidelines for Use
The Hough transform can be used to identify the parameter(s) of a curve which best fits a set of given edge points. This edge description is commonly obtained from a feature detecting operator such as the Roberts Cross, Sobel or Canny edge detector and may be noisy, i.e. it may contain multiple edge fragments corresponding to a single whole feature. Furthermore, as the output of an edge detector defines only where features are in an image, the work of the Hough transform is to determine both what the features are (i.e. to detect the feature(s) for which it has a parametric (or other) description) and how many of them exist in the image.
In order to illustrate the Hough transform in detail, we begin with the simple image of two occluding rectangles,
The Canny edge detector can produce a set of boundary descriptions for this part, as shown in
Here we see the overall boundaries in the image, but this result tells us nothing about the identity (and quantity) of feature(s) within this boundary description. In this case, we can use the Hough (line detecting) transform to detect the eight separate straight lines segments of this image and thereby identify the true geometric structure of the subject.
If we use these edge/boundary points as input to the Hough transform, a curve is generated in polar
Histogram equalizing the image allows us to see the patterns of information contained in the low intensity pixel values, as shown in
Note that, although
Curves generated by collinear points in the gradient image intersect in peaks
Mapping back from Hough transform space (i.e. de-Houghing) into cartesian space yields a set of line descriptions of the image subject. By overlaying this image on an inverted version of the original, we can confirm the result that the Hough transform found the 8 true sides of the two rectangles and thus revealed the underlying geometry of the occluded scene
Note that the accuracy of alignment of detected and original image lines, which is obviously not perfect in this simple example, is determined by the quantization of the accumulator array. (Also note that many of the image edges have several detected lines. This arises from having several nearby Hough-space peaks with similar line parameter values. Techniques exist for controlling this effect, but were not used here to illustrate the output of the standard Hough transform.)
Note also that the lines generated by the Hough transform are infinite in length. If we wish to identify the actual line segments which generated the transform parameters, further image analysis is required in order to see which portions of these infinitely long lines actually have points on them.
To illustrate the Hough technique's robustness to noise, the Canny edge description has been corrupted by 1% salt and pepper noise
before Hough transforming it. The result, plotted in Hough space, is
De-Houghing this result (and overlaying it on the original) yields
(As in the above case, the relative threshold is 40%.)
The sensitivity of the Hough transform to gaps in the feature boundary can be investigated by transforming the image
, which has been edited using a paint program. The Hough representation is
and the de-Houghed image (using a relative threshold of 40%) is
In this case, because the accumulator space did not receive as many entries as in previous examples, only 7 peaks were found, but these are all structurally relevant lines.
We will now show some examples with natural imagery. In the first case, we have a city scene where the buildings are obstructed in fog,
If we want to find the true edges of the buildings, an edge detector (e.g. Canny) cannot recover this information very well, as shown in
However, the Hough transform can detect some of the straight lines representing building edges within the obstructed region. The histogram equalized accumulator space representation of the original image is shown in
If we set the relative threshold to 70%, we get the following de-Houghed image
Only a few of the long edges are detected here, and there is a lot of duplication where many lines or edge fragments are nearly colinear. Applying a more generous relative threshold, i.e. 50%, yields
yields more of the expected lines, but at the expense of many spurious lines arising from the many colinear edge fragments.
Our final example comes from a remote sensing application. Here we would like to detect the streets in the image
of a reasonably rectangular city sector. We can edge detect the image using the Canny edge detector as shown in
However, street information is not available as output of the edge detector alone. The image
shows that the Hough line detector is able to recover some of this information. Because the contrast in the original image is poor, a limited set of features (i.e. streets) is identified.
Common Variants
Generalized Hough Transform
The generalized Hough transform is used when the shape of the feature that we wish to isolate does not have a simple analytic equation describing its boundary. In this case, instead of using a parametric equation of the curve, we use a look-up table to define the relationship between the boundary positions and orientations and the Hough parameters. (The look-up table values must be computed during a preliminary phase using a prototype shape.)
For example, suppose that we know the shape and orientation of the desired feature. (See Figure 3.) We can specify an arbitrary reference point
Figure 3 Description of R-table components.
The Hough transform space is now defined in terms of the possible positions of the shape in the image, i.e. the possible ranges of
(The
Interactive Experimentation
You can interactively experiment with this operator by clicking here.
Exercises
Figure 4 Features to input to the Hough transform line detector.
create a series of images with which you can investigate the ability of the Hough line detector to extract occluded features. For example, begin using translation and image addition to create an image containing the original image overlapped by a translated copy of that image. Next, use edge detection to obtain a boundary description of your subject. Finally, apply the Hough algorithm to recover the geometries of the occluded features.
try the following: a) Generate a series of boundary descriptions of the image using different levels of Gaussian noise. How noisy (i.e. broken) does the edge description have to be before Hough is unable to detect the original geometric structure of the scene? b) Corrode the boundary descriptions with different levels of salt and pepper noise. At what point does the combination of broken edges and added intensity spikes render the Hough line detector useless?
and
Experiment with the Hough circle detector on
and
Figure 5 Hough circle detection with gradient information.
a) Describe how you would modify the 3-D circle detector accumulator array in order to take this information into account. b) To this algorithm we may want to add gradient magnitude information. Suggest how to introduce weighted incrementing of the accumulator.
References
D. Ballard and C. Brown Computer Vision, Prentice-Hall, 1982, Chap. 4.
R. Boyle and R. Thomas Computer Vision:A First Course, Blackwell Scientific Publications, 1988, Chap. 5.
A. Jain Fundamentals of Digital Image Processing, Prentice-Hall, 1989, Chap. 9.
D.
Local Information
Specific information about this operator may be found here.
More general advice about the local HIPR installation is available in the Local Information introductory section.
2
The Hough transform can be used to determine the parameters of a circle when a number of points that fall on the perimeter are known. A circle with radius R and center (a,b) can be described with the parametric equations
x=a+R cos(t)
y=b+R sin(t)
When the angle t sweeps through the full 360 degree range the points (x,y) trace the perimeter of a circle.
If an image contains many points, some of which fall on perimeters of circles, then the job of the search program is to find parameter triplets (a,b,R) to describe each circle. The fact that the parameter space is 3D makes a direct implementation of the Hough technique more expensive in computer memory and time. There is value in finding techniques to limit the size of the search space. We will begin with the most simple case and progress to some that are more complicated.
The program is implemented in IDL as CircleHoughLink.pro
If the circles in an image are of known radius R, then the search can be reduced to one in two dimensions. The objective is to find the (a,b) coordinates of the centers. a=x-R cos(t) The locus of (a,b) points in the parameter space fall on a circle of radius R centered at (x,y). The true center point will be common to all parameter circles, and can be found with a Hough accumulation array. |
|
Multiple circles with the same radius can be found with the same technique. The centerpoints are represented as red cells in the parameter space drawing. Overlap of circles can cause spurious centers to also be found, such as at the blue cell. |
|
If the radius is not known, then the locus of points in parameter space will fall on the surface of a cone. Each point (x,y) on the perimeter of a circle will produce a cone surface in parameter space. The triplet (a,b,R) will correspond to the accumulation cell where the largest number of cone surfaces intersect. |
|
Example: Points on overlapping circles of known radius. |
|
The CHT accumulation matrix is shown in a surface plot at the right. Two peaks are very clear. These correspond to the locations of the centers of the circles. |
|
N R Cx Cy |
|
Example: Search for circles in the coins1 image. |
|
We need to find the edges in the original image. The first step is to convert it to a binary image with a threshold operation. That is followed by a morphological closing to remove many of the holes in the binary image. The closing is followed with an erosion with a small structuring element to remove small noise pixels in the background. The result is shown at the right. |
|
The points found by the edge processing are shown at the right. These were submitted to the CHT program. The coordinates found are listed below. The coordinate data was used to draw the circle plots below right. The circles have been labeled with the indexes in the corresponding table. |
|
N R Cx Cy |
|
The CHT search finds the peaks in the A matrix. The peaks can be seen by looking at surface plots of the A matrix for each radius value. These are shown in the four plots below. Note that the peaks at R=73, which corresponds to the quarter, are quite clear and distinct. There are three clear peaks for the three quarters. The peak for R=64 is also very distinct. This is the radius of the lone nickle. The peaks for R=52 and R=54, however, are less distinct. These radius values are quite close, and the cells near the center of the penny and dime objects get populated by both radius counters.
|
|
|
|
|
|