Back to Adaptive Vision Studio website

You are here: Start » Filter Reference » OpenCV » Feature Detection » cvHoughLines

cvHoughLines


Module: OpenCV

Finds lines in a binary image using standard Hough transform.

Name Type Range Description
inImage Image UINT8, single-channel input image.
inRho Real 0.0 - Distance resolution of the accumulator in pixels.
inTheta Real 0.0 - Angle resolution of the accumulator in degrees.
inThreshold Integer 1 - Accumulator threshold parameter.
inSrn Real For the multi-scale Hough transform, it is a divisor for the distance resolution rho. The coarse accumulator distance resolution is rho and the accurate accumulator resolution is rho/srn . If both srn=0 and stn=0 , the classical Hough transform is used. Otherwise, both these parameters should be positive.
inStn Real For the multi-scale Hough transform, it is a divisor for the distance resolution theta.
outLines Line2DArray Output array of lines.

Description

The operation detects straight edges in the inImage using the Hough Transform approach and treats them as infinite lines. Input image is treated as binary image. Therefore all non-zero pixels are assumed to be edges.

Examples

cvHoughLines performed on the sample image with inRho = 2.0, inTheta = 10.0, inThreshold = 250.

Remarks

Note, that non-zero pixels are treated as edge, which is different approach from the one in cvHoughCircles filter. To obtain edges image, one can use i.e. cvCanny filter.

Errors

This filter can throw an exception to report error. Read how to deal with errors in Error Handling.

List of possible exceptions:

Error type Description
DomainError Input image must be UINT8 single-channel in cvHoughLines.
DomainError inRho, inTheta and inThreshold must be positive in cvHoughLines.

Complexity Level

This filter is available on Basic Complexity Level.

See Also

  • cvHoughCircles – Finds circles in a grayscale image using a Hough transform.
  • cvHoughLinesP – Finds lines segments in a binary image using probabilistic Hough transform.
  • cvCanny – Finds edges in an image using Canny algorithm.