def voting(edge):
    (H, W) = edge.shape
    drho = 1
    dtheta = 1
    rho_max = np.ceil(np.sqrt(((H ** 2) + (W ** 2)))).astype(np.int)
    hough = np.zeros(((rho_max * 2), 180), dtype=np.int)
    ind = np.where((edge == 255))
    for (y, x) in zip(ind[0], ind[1]):
        for theta in range(0, 180, dtheta):
            t = ((np.pi / 180) * theta)
            rho = int(((x * np.cos(t)) + (y * np.sin(t))))
            hough[((rho + rho_max), theta)] += 1
    out = hough.astype(np.uint8)
    return out
def voting(edge):
    (H, W) = edge.shape
    drho = 1
    dtheta = 1
    rho_max = np.ceil(np.sqrt(((H ** 2) + (W ** 2)))).astype(np.int)
    hough = np.zeros(((rho_max * 2), 180), dtype=np.int)
    ind = np.where((edge == 255))
    for (y, x) in zip(ind[0], ind[1]):
        for theta in range(0, 180, dtheta):
            t = ((np.pi / 180) * theta)
            rho = int(((x * np.cos(t)) + (y * np.sin(t))))
            hough[((rho + rho_max), theta)] += 1
    out = hough.astype(np.uint8)
    return out