The Hough transform is a general technique for identifying the locations and orientations of certain types of features in a digital image. Developed by Paul Hough in 1962 and patented by IBM, the transform consists of parameterizing a description of a feature at any given location in the original image's space. A mesh in the space defined by these parameters is then generated, and at each mesh point a value is accumulated, indicating how well an object generated by the parameters defined at that point fits the given image. Mesh points that accumulate relatively larger values then describe features that may be projected back onto the image, fitting to some degree the features actually present in the image.
The simplest form of the Hough transform is the Hough line transform. Suppose we are attempting to describe lines that match edges in a two-dimensional image. If we perform an edge-detection technique on the image, we might obtain an image like the following.
To use the Hough transform, we need a way to characterize a line. One representation of a line is the slope-intercept form
where is the slope of the line and is the -intercept (that is, the component of the coordinate where the line intersects the -axis). Given this characterization of a line, we can then iterate through any number of lines that pass through any given point . By iterating through fixed values of , we can solve for by
However, this method is not very stable. As lines get more and more vertical, the magnitudes of and grow towards infinity. A more useful representation of a line is its normal form.
This equation specifies a line passing through that is perpendicular to the line drawn from the origin to
in polar space (i.e.,
in rectangular space). For each point on a line, and are constant.
Now, for any given point , we can obtain lines passing through that point by solving for and . By iterating through possible angles for , we can solve for by (2) directly. This method proves to be more effective than (1), as it is numerically stable for matching lines of any angle.
To generate the Hough transform for matching lines in our image, we choose a particular granularity for our lines (e.g., ), and then iterate through the angles defined by that granularity. For each angle , we then solve for
, and then increment the value located at
. This process can be thought of as a “vote” by the point for the line defined by
, and variations on how votes are generated exist for making the transform more robust.
The result is a new image defined on a polar mesh, such as the one below (generated from the previous image).
Note that in this representation we have projected the polar space onto a rectangular space. The origin is in the upper-left corner, the axis extends to the right, and the axis extends downward. The image has been normalized, so that each pixel's intensity represents the ratio of the original value at that location to the brightest original value.
The intensity of a pixel corresponds to the number of votes it received relative to the pixel that received the most votes.
Iterating through each value of for a particular in the original image generates a curve in the rectangular representation of the Hough transform. Lines that intersect in the same location are generated by collinear points. Thus, if we locate the brightest points in the image, we will obtain parameters describing lines that pass through many points in our original image. Many methods exist for doing this; we may simply threshold the Hough transform image, or we can locate the local
maxima. We then get a set of infinite lines, as below. This notion corresponds neatly with the notion of a voting process; the brighter pixels represented coordinates in
space that got the most votes, and thus are more likely to generate lines that fit many points.
that we deem bright enough in the Hough transform, we can then generate a line from the parameterization given earlier. Here is the projection of some lines obtained from the previous image's Hough transform, drawn on top of the original image.
We can also use this information to break these lines up into line segments that fit our original binary image well. Below is an example of the line segments we might obtain, drawn on top of the original image.
The Hough transform can be used for representing objects besides lines. For instance, a circle can be parameterized as
Here, is the coordinate of the center of the circle that passes through , and is its radius. Since there are three parameters for this equation, it follows that the Hough transform will be a three-dimensional image. Therefore circles require more computation to find than lines. For this reason the Hough transform is more typically used for simpler curves, such as straight lines and
The general Hough transform is used when an analytical description of the feature we are searching for is not possible. Instead of a parametric equation describing the feature, we use some sort of lookup table, correlating locations and orientations of potential features in the original image to some set of parameters in the Hough transform space.
- Gonzalez, R.C. and Woods, R.E., Digital Image Processing, Prentice Hall, 1993.