Example #1
0
def skeletor(img, e1, e2):
    while True:
        pimg = img
        for r in range(4):
            img = img-pymorph.supgen(img, e1)
            e1 = pymorph.interot(e1, theta=90)
            img = img-pymorph.supgen(img, e2)
            e2 = pymorph.interot(e2, theta=90)
        if (pimg == img).all():
            break
    return img
Example #2
0
def pruner(img, prune):
    while True:
        pimg = img
        img = img - pymorph.supgen(img, prune)
        if (pimg == img).all():
            break
    return img
Example #3
0
def test_supgen():
    f = np.zeros((4, 4), np.bool)
    f[3, 2] = 1
    f[3, 3] = 1
    f[2, 2] = 1
    interval = (np.reshape([1, 0, 0, 1], (2, 2)), np.reshape([0, 1, 0, 0], (2, 2)))
    match = supgen(f, interval)
    assert match.sum() == 1
Example #4
0
def test_supgen():
    f = np.zeros((4, 4), np.bool)
    f[3, 2] = 1
    f[3, 3] = 1
    f[2, 2] = 1
    interval = (np.reshape([1, 0, 0, 1],
                           (2, 2)), np.reshape([0, 1, 0, 0], (2, 2)))
    match = supgen(f, interval)
    assert match.sum() == 1