HoughLines

Description

Finds lines in a binary image using the standard Hough transform.

Signature

cv2.HoughLines(image, rho, theta, threshold[, lines[, srn[, stn[, min_theta[, max_theta]]]]]) → lines

Parameters

Explanation

In general, lines can be represented by the equation \(\rho = x \cos \theta + y \cos \theta\), where \(\theta\) lies in the range \([0, \pi]\) and \(\rho\) has a finite range determined by the image. The parameters \(\rho\) and \(\theta\) in the function signature determine how many pieces these finite ranges are partitioned into. For each pixel \((x,y)\) in the image, and for each value of \(\theta\), the value of \(\rho\) can be determined by the line equation. This value is then used to update an accumulator matrix to track the number of pixels satisfying each potential combination of \(\rho\) and \(\theta\).

Once the accumulator matrix has been constructed, the threshold parameter determines which entries in the accumulator matrix are large enough (have enough pixels mapped) to form a line. A larger threshold value will result in fewer lines.


References

Created with OpenCV 4.4.0