Skip to content
AI360Xpert
Playgrounds

Foundations

Hough Transform

how casting the problem into a parameter space turns line detection into a voting problem.

Stage 1 of 4: Image space

Image space showing points and lines.

Hough space showing voting curves.

  • Image Point
  • Hough Curve
  • Detected Line

Edges in the image are represented as points in the (x, y) coordinate system.

Discover how computer vision translates the difficult problem of finding lines in an image into the simple problem of finding intersecting curves in a parameter space.

Finding lines in an image seems trivial to a human, but it is notoriously difficult for an algorithm. In an edge-detected image, you simply have a sea of disconnected pixels. How do you group them into mathematical lines?

The Hough Transform solves this by turning the search for lines into a voting system. Instead of asking "which line connects these pixels?", it asks every pixel to draw all the possible lines that could pass through it in a new mathematical realm called Hough Space.

When multiple pixels belong to the same straight line in the original image, their curves perfectly intersect at a single point in Hough space. The brightest points in the accumulator thus reveal the dominant lines in the image.

Reference

Rho (ρ)
Distance from the origin to the line along a vector perpendicular to the line.
Theta (θ)
Angle of the perpendicular projection from the origin to the line.
Line equation
ρ = x * cos(θ) + y * sin(θ)

Break it on purpose

Lower the threshold too much, and noise will register as lines. Raise it too high, and valid edges disappear.