def find_lines(img):
edges = cv2.Canny(img,100,200)
threshold = 60
minLineLength = 10
lines = cv2.HoughLinesP(edges, 1, np.pi/180, threshold, 0, minLineLength, 20);
if (lines is None or len(lines) == 0):
return
#print lines
for line in lines[0]:
#print line
cv2.line(img, (line[0],line[1]), (line[2],line[3]), (0,255,0), 2)
cv2.imwrite("line_edges.jpg", edges)
cv2.imwrite("lines.jpg", img)
评论列表
文章目录