Skip to content

Commit 3b8c83c

Browse files
Update py_houghlines.rst
The current code identified only one random line on the example image. This could be confusing for the novice perusing this for their study. Modified the code to detect all the lines in the image
1 parent 4353285 commit 3b8c83c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

source/py_tutorials/py_imgproc/py_houghlines/py_houghlines.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,13 @@ Everything explained above is encapsulated in the OpenCV function, **cv2.HoughLi
5151
import cv2
5252
import numpy as np
5353

54-
img = cv2.imread('dave.jpg')
54+
img = cv2.imread('dave.png')
5555
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
5656
edges = cv2.Canny(gray,50,150,apertureSize = 3)
5757

5858
lines = cv2.HoughLines(edges,1,np.pi/180,200)
59-
for rho,theta in lines[0]:
59+
for line in lines:
60+
rho,theta= line[0]
6061
a = np.cos(theta)
6162
b = np.sin(theta)
6263
x0 = a*rho

0 commit comments

Comments
 (0)