def gap_measures(im, wv):
    pmetric = (lambda p: sqrt(dot(p[:(- 1)], p[:(- 1)])))
    (left, right) = group_ends(list(filter_ends(wv, 100, im.shape)))
    shape = (len(left), len(right))
    d = zeros(shape)
    l = zeros(shape)
    c = zeros(shape)
    cx = zeros(shape)
    cy = zeros(shape)
    for (i, a) in enumerate(left):
        for (j, b) in enumerate(right):
            dx = (a.x[0] - b.x[(- 1)])
            dy = (a.y[0] - b.y[(- 1)])
            d[(i, j)] = hypot(dx, dy)
            (px, py) = solve_polynomial_join(b, a)
            (lpx, lpy) = solve_polynomial_join(a, a, reverse=1)
            (rpx, rpy) = solve_polynomial_join(b, b, reverse=1)
            cx[(i, j)] = max(pmetric((px - lpx)), pmetric((px - rpx)))
            cy[(i, j)] = max(pmetric((px - lpx)), pmetric((py - rpy)))
            l[(i, j)] = compute_join_score(im, px, py)
            plot_test(px, py)
    return (d, l, cx, cy)
def gap_measures(im, wv):
    pmetric = (lambda p: sqrt(dot(p[:(- 1)], p[:(- 1)])))
    (left, right) = group_ends(list(filter_ends(wv, 100, im.shape)))
    shape = (len(left), len(right))
    d = zeros(shape)
    l = zeros(shape)
    c = zeros(shape)
    cx = zeros(shape)
    cy = zeros(shape)
    for (i, a) in enumerate(left):
        for (j, b) in enumerate(right):
            dx = (a.x[0] - b.x[(- 1)])
            dy = (a.y[0] - b.y[(- 1)])
            d[(i, j)] = hypot(dx, dy)
            (px, py) = solve_polynomial_join(b, a)
            (lpx, lpy) = solve_polynomial_join(a, a, reverse=1)
            (rpx, rpy) = solve_polynomial_join(b, b, reverse=1)
            cx[(i, j)] = max(pmetric((px - lpx)), pmetric((px - rpx)))
            cy[(i, j)] = max(pmetric((px - lpx)), pmetric((py - rpy)))
            l[(i, j)] = compute_join_score(im, px, py)
            plot_test(px, py)
    return (d, l, cx, cy)