Start » Filter Reference » OpenCV » Feature Detection » cvHoughLines

cvHoughLines


Module: OpenCV

Finds lines in a binary image using standard Hough transform.

Name Type Range Description
Input value
inImage Image UINT8, single-channel input image.
Input value
inRho Real 0.1 - Distance resolution of the accumulator in pixels.
Input value
inTheta Real 0.1 - Angle resolution of the accumulator in degrees.
Input value
inThreshold Integer 1 - Accumulator threshold parameter.
Input value
inSrn Real 0.0 - 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.
Input value
inStn Real 0.0 - For the multi-scale Hough transform, it is a divisor for the distance resolution theta.
Input value
inMinTheta Double For standard and multi-scale Hough transform, minimum angle to check for lines.
Input value
inMaxTheta Double For standard and multi-scale Hough transform, maximum angle to check for lines.
Output value
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 Both inSrn and inStn should be positive or both should be zero in cvHoughLines.
DomainError Input image must be UINT8 single-channel 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.