detecing hough lines on holistically nested edged image
I am trying to get hough lines for document detection with HED (holistically nested edge detection) but not getting correct hough lines for the document detection.
Code:
lines = cv2.HoughLines(out,1,np.pi/180,200,np.array([]),0,0)
for line in lines:
rho=line[0][0]
theta = line[0][1];
a = np.cos(theta);
b = np.sin(theta);
x0 = a*rho; y0 = b*rho;
x1 = np.round(x0 + 1000*(-b))
y1 = np.round(y0 + 1000*(a))
x2 = np.round(x0 - 1000*(-b))
y2 = np.round(y0 - 1000*(a))
cv2.line(original,(int(x1),int(y1)), (int(x2),int(y2)),(0,0,255), 3)
here out is hed image and original is the original image. out(HED image)
original image
enter code here
Here is link: HED
You shouldn't display every line, just those with a high number of counts in the accumulator. The thresholding is probably something that you will have to tune to get best results.
tried thresholding but same results.