Exemplo n.º 1
0
def test_hscharr_horizontal():
    """Horizontal Scharr on an edge should be a horizontal line."""
    i, j = np.mgrid[-5:6, -5:6]
    image = (i >= 0).astype(float)
    result = F.hscharr(image)
    # Fudge the eroded points
    i[np.abs(j) == 5] = 10000
    assert (np.all(result[i == 0] == 1))
    assert (np.all(result[np.abs(i) > 1] == 0))
Exemplo n.º 2
0
def test_hscharr_horizontal():
    """Horizontal Scharr on an edge should be a horizontal line"""
    i, j = np.mgrid[-5:6, -5:6]
    image = (i >= 0).astype(float)
    result = F.hscharr(image)
    # Fudge the eroded points
    i[np.abs(j) == 5] = 10000
    assert (np.all(result[i == 0] == 1))
    assert (np.all(result[np.abs(i) > 1] == 0))
Exemplo n.º 3
0
def test_hscharr_vertical():
    """Horizontal Scharr on a vertical edge should be zero."""
    i, j = np.mgrid[-5:6, -5:6]
    image = (j >= 0).astype(float)
    result = F.hscharr(image)
    assert_allclose(result, 0)
Exemplo n.º 4
0
def test_hscharr_mask():
    """Horizontal Scharr on a masked array should be zero."""
    np.random.seed(0)
    result = F.hscharr(np.random.uniform(size=(10, 10)),
                       np.zeros((10, 10), bool))
    assert_allclose(result, 0)
Exemplo n.º 5
0
def test_hscharr_zeros():
    """Horizontal Scharr on an array of all zeros."""
    result = F.hscharr(np.zeros((10, 10)), np.ones((10, 10), bool))
    assert_allclose(result, 0)
Exemplo n.º 6
0
def test_hscharr_zeros():
    """Horizontal Scharr on an array of all zeros"""
    result = F.hscharr(np.zeros((10, 10)), np.ones((10, 10), bool))
    assert (np.all(result == 0))
Exemplo n.º 7
0
def test_hscharr_vertical():
    """Horizontal Scharr on a vertical edge should be zero"""
    i, j = np.mgrid[-5:6, -5:6]
    image = (j >= 0).astype(float)
    result = F.hscharr(image)
    assert (np.all(result == 0))
Exemplo n.º 8
0
def test_hscharr_mask():
    """Horizontal Scharr on a masked array should be zero"""
    np.random.seed(0)
    result = F.hscharr(np.random.uniform(size=(10, 10)),
                       np.zeros((10, 10), bool))
    assert (np.all(result == 0))
Exemplo n.º 9
0
def test_hscharr_zeros():
    """Horizontal Scharr on an array of all zeros"""
    result = F.hscharr(np.zeros((10, 10)), np.ones((10, 10), bool))
    assert (np.all(result == 0))