I am trying to filter an image using Hough lines but something just isn't working.
I created the following subroutine, which was copy pasted without modification from the documentation:
def FilterLines(img):
lines = cv2.HoughLines(img,1,np.pi/180,200)
blank_image = np.zeros((img.shape[0], img.shape[1]), np.uint8)
if (lines is None):
return blank_image
for rho,theta in lines[0]:
a = np.cos(theta)
b = np.sin(theta)
x0 = a*rho
y0 = b*rho
x1 = int(x0 + 1000*(-b))
y1 = int(y0 + 1000*(a))
x2 = int(x0 - 1000*(-b))
y2 = int(y0 - 1000*(a))
cv2.line(blank_image,(x1,y1),(x2,y2),255,1)
return blank_image
I then give it the following test image:

So it kinda detected a couple of lines at the bottom and nothing else.
Why can;t the function detect lines in such a simple image?

