Пример #1
0
def test_cdilate():
    from mahotas.tests.pymorph_copy import cdilate as slow_cdilate
    np.random.seed(332)
    Bc = np.zeros((3,3),bool)
    Bc[1] = 1
    Bc[:,1] = 1
    for n in range(8):
        f = np.random.random_sample((128,128))
        f = (f > .9)
        g = np.random.random_sample((128,128))
        g = (g > .7)
        assert np.all(mahotas.cdilate(f,g,Bc,n+1) == slow_cdilate(f,g,Bc,n+1))
def test_cdilate():
    from mahotas.tests.pymorph_copy import cdilate as slow_cdilate
    np.random.seed(332)
    Bc = np.zeros((3,3),bool)
    Bc[1] = 1
    Bc[:,1] = 1
    for n in range(8):
        f = np.random.random_sample((128,128))
        f = (f > .9)
        g = np.random.random_sample((128,128))
        g = (g > .7)
        assert np.all(mahotas.cdilate(f,g,Bc,n+1) == slow_cdilate(f,g,Bc,n+1))
def test_cdilate_large():
    f = np.zeros((8,8),bool)
    f[4,4] = 1
    assert np.all(mh.cdilate(f, 12))