detecing hough lines on holistically nested edged image

asked 2019-09-26 07:10:02 -0600

Naman Gupta gravatar image

updated 2019-09-26 11:38:11 -0600

supra56 gravatar 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.image description

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) image description

original image

enter code here
edit retag flag offensive close merge delete

Comments

Here is link: HED

supra56 gravatar imagesupra56 ( 2019-09-26 11:42:19 -0600 )edit

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.

MikeTronix gravatar imageMikeTronix ( 2019-09-26 15:58:36 -0600 )edit

tried thresholding but same results.

Naman Gupta gravatar imageNaman Gupta ( 2019-09-26 20:58:27 -0600 )edit