Hough_lines

def hough_lines_acc(img_edges, rho_res=1, theta_res=None):
    rows,cols = img_edges.shape
    ys,xs = np.nonzero(img_edges)
    thetas = np.arange(0,np.pi,theta_res)
    cos_t = np.cos(thetas)
    sin_t = np.sin(thetas)
    max_r = np.sqrt(rows*rows+cols*cols)
    N_r_u = np.int64((2*max_r) / (rho_res))
    rho = np.arange(-max_r,max_r,step=rho_res)
    N_t = len(thetas)
    H = np.zeros([N_r_u,N_t])
    x_cos_t = np.outer(xs,cos_t)
    y_sin_t = np.outer(ys,sin_t)
    r = np.int64(x_cos_t+y_sin_t+max_r)
    np.add.at(H, (r, range(N_t)), 1)
    return H,rho,thetas