HoughFeature#

class HoughFeature(image: _ImageBase, ntheta: int = 180, drho: int = 1)[source]#

Hough line features

Parameters:
  • image (Image) – greyscale image

  • ntheta (int, optional) – number of steps in the theta direction, defaults to 180

  • drho (int, optional) – increment size in the rho direction, defaults to 1

Create a Hough line feature object. It can be used to detect:

  • lines using the classical Hough algorithm lines

  • line segments using the probabilistic Hough algorithm lines_p

The Hough accumulator is a 2D array that counts votes for lines

\[u \cos \theta + v \sin \theta = \rho\]

with quantized parameters \(\theta\) and \(\rho\). The parameter \(\theta\) is quantized into ntheta steps spanning the interval \([-\pi, \pi)\), while \(\rho\) is quantized into steps of drho spanning the vertical dimension of the image.

Note

  • Lines are not detected until lines or lines_p is called. This instance simply holds parameters.

  • The OpenCV implementation works with uint8 images only, other formats will be converted to uint8.

References:
Seealso:

lines lines_p

Methods

accumulator([skip])

Compute the Hough accumulator

lines(minvotes)

Get Hough lines

lines_p(minvotes[, minlinelength, ...])

Get probabilistic Hough lines

plot_accumulator(**kwargs)

Plot the Hough accumulator array

plot_lines(lines, *args, **kwargs)

Plot Hough lines