The Hough transform links local edge evidence by making edge pixels vote for a global geometric structure. For line detection, an accumulator peak represents one detected line.

Main idea

One image point becomes a voting curve in Hough space. Many collinear points produce curves that meet at one peak.


Why Edge Linking Is Needed

Gradient thresholding and Canny produce edge pixels, but a vision task often needs a complete boundary or line.

  • Thresholding can leave isolated edgels
  • Weak contrast can create gaps
  • Object boundaries usually extend across many pixels
  • A global model can combine the local evidence

Line Parameterization

The normal vector to a line is:

For a point on the line:

This gives the normal form:

SymbolMeaning
Direction of the line normal
Signed normal coordinate of the line
$\rho
One point in Hough space that represents one image line

This form handles vertical lines without using an infinite slope.


One Point Votes for Many Lines

One image point can lie on many possible lines. For a fixed point , vary and calculate:

For the point :

This equation forms one sinusoidal voting curve in Hough space.

Image space and Hough space use different objects

One point in image space becomes one curve in Hough space. One line in image space becomes one peak in the accumulator.


Accumulator Voting

flowchart LR

E["Edge pixels"] --> V["Voting curves<br/>in rho-theta space"]
V --> A["Accumulator counts"]
A --> P["Peak"]
P --> L["Detected image line"]

The algorithm is:

  1. Take each edge pixel
  2. Evaluate for the allowed values
  3. Add votes to the corresponding accumulator cells
  4. Find accumulator peaks
  5. Map each peak back to an image line

Two-Point Example

Consider two points on a horizontal line:

Each point creates a different voting curve. Their curves meet at the parameters of the shared horizontal line. Using :

Both points therefore vote for . The equivalent endpoint representation can also appear when both angle endpoints are included.


From Local Edges to Global Lines

A rectangle with one diagonal contains five lines:

  • Four rectangle sides
  • One diagonal

Its Hough accumulator therefore contains five principal peaks. Each peak combines votes from many local edge pixels into one global geometric structure.