Skip to content
ExtendedSource checked

Hough Transform

Detects shapes by voting in a parameter space.

Quick Facts

Compact metadata for implementation and discovery.

Category
Image Processing
Difficulty
Intermediate
Family
Shape Detection
Tier
Extended
Status
Verified
Review
Source Checked
Sources
2
Formulas
1
Relationships
1
Code example
Ready
Visualization
Ready

Overview

The Hough Transform maps edge pixels to possible shape parameters and finds peaks where many pixels agree.

Core Concepts

pixel operationgradient responsegeometric calculationshape detectionpixel neighborhoodlocal operationimage transform

Quick facts

Complexity

Runtime and memory behavior at a glance.

Best

O(p a)

Average

O(p a)

Worst

O(p a)

Space

O(a)

When to Use

  • Use Hough Transform when you need to transform image points into parameter votes.
  • Use it for line detection with inputs like edge image.
  • Use it when pixel-level transformation or region analysis is the main task.
  • Use it when the Shape Detection tradeoff is acceptable for the problem size.

When Not to Use

  • Avoid it when lighting, noise, or color space changes make a fixed rule unreliable.
  • Avoid it when the required output is not detected lines or shapes.

What It Does

  • Transforms image points into parameter votes
  • Finds peaks that represent shapes

Use Cases

  • Line detection
  • Circle detection
  • Document analysis

Inputs

  • Edge image
  • Shape parameterization

Outputs

  • Detected lines or shapes

Key Formulas (1)

Line parameterization

ρ = x · cos(θ) + y · sin(θ)
rho = x * cos(theta) + y * sin(theta)

Maps image points into votes for possible lines.

Pseudocode

  1. 1.Extract edge pixels
  2. 2.For each edge pixel, vote for compatible shape parameters
  3. 3.Accumulate votes in parameter space
  4. 4.Find peaks above a threshold
  5. 5.Return shapes represented by peaks

Canonical Example

Input
image = 3x3 grayscale pixels
Output
processed 3x3 image or mask
Explanation
Hough Transform: The algorithm transforms local pixel values into a clearer feature, mask, or image.

Implementation Notes

  • Keep the input contract explicit: Edge image; Shape parameterization.
  • Use this step as the implementation spine: Extract edge pixels.
  • Then preserve the next state change: For each edge pixel, vote for compatible shape parameters.
  • Test on tiny images where each expected output pixel can be inspected by hand.

Common Pitfalls

  • The accumulator resolution controls precision and cost.
  • Processing color, alpha, and boundary pixels inconsistently.
  • Returning detected lines or shapes without handling empty, invalid, or boundary inputs.

Interactive Mechanism Walkthrough

Spatial Primitive & Sweep-Line Canvas

Show edge pixels casting votes that form peaks for lines.

Hough Transform mechanism walkthrough step 1 of 5
Step 1 of 5: Extract edge pixels
parameter-voting

Notes

Hough Transform operates in O(p a) time and O(a) space within the Shape Detection family. Key governing relation: rho = x * cos(theta) + y * sin(theta). Often compared with Canny Edge Detection and Line Segment Intersection.

Sources (2)

What each reference supports for this entry.

Duda-Hart Hough Transform

Paper

Reference for using the Hough transform to detect lines and curves by accumulator voting.

Open source

Computer Vision: Algorithms and Applications

Book

Computer-vision reference supporting Hough Transform feature extraction, image registration, segmentation, or multiscale image-analysis workflow.

Open source

Explore Next

Good next jumps from the relationship graph, ranked for useful discovery.

Often paired withCanny Edge Detection

Hough transforms often consume edge maps produced by Canny-style detectors.

Tags

Image ProcessingEdge DetectionGeometry