如何在python中没有HoughLines()的情况下检测行|禁止使用“ Hough”关键字

时间:2019-02-16 15:38:13

标签: image-processing computer-vision hough-transform

edge=cv2.Canny(img,50,150,apertureSize = 3)
lines= cv2.HoughLines(edge,1,np.pi/180,100)
for i in range(len(lines)):
    for rho,theta in lines[i]:
        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(img,(x1,y1),(x2,y2),(0,0,255),1)

plt.imshow(img)

在python的Opencv中没有HoughLines()的情况下我可以解决此问题吗?

0 个答案:

没有答案