Exemplo n.º 1
0
 def test_01_02_horizontal(self):
     """vertical Sobel on a horizontal edge should be zero"""
     i, j = np.mgrid[-5:6, -5:6]
     image = (i >= 0).astype(float)
     result = F.vsobel(image)
     eps = .000001
     assert (np.all(np.abs(result) < eps))
Exemplo n.º 2
0
 def test_01_02_horizontal(self):
     """vertical Sobel on a horizontal edge should be zero"""
     i, j = np.mgrid[-5:6, -5:6]
     image = (i >= 0).astype(float)
     result = F.vsobel(image)
     eps = .000001
     assert (np.all(np.abs(result) < eps))
Exemplo n.º 3
0
 def test_01_01_vertical(self):
     """Vertical Sobel on an edge should be a vertical line"""
     i, j = np.mgrid[-5:6, -5:6]
     image = (j >= 0).astype(float)
     result = F.vsobel(image)
     # Fudge the eroded points
     j[np.abs(i) == 5] = 10000
     assert (np.all(result[j == 0] == 1))
     assert (np.all(result[np.abs(j) > 1] == 0))
Exemplo n.º 4
0
 def test_01_01_vertical(self):
     """Vertical Sobel on an edge should be a vertical line"""
     i, j = np.mgrid[-5:6, -5:6]
     image = (j >= 0).astype(float)
     result = F.vsobel(image)
     # Fudge the eroded points
     j[np.abs(i) == 5] = 10000
     assert (np.all(result[j == 0] == 1))
     assert (np.all(result[np.abs(j) > 1] == 0))
Exemplo n.º 5
0
 def test_00_01_mask(self):
     """Vertical Sobel on a masked array should be zero"""
     np.random.seed(0)
     result = F.vsobel(np.random.uniform(size=(10, 10)),
                       np.zeros((10, 10), bool))
     assert (np.all(result == 0))
Exemplo n.º 6
0
 def test_00_00_zeros(self):
     """Vertical sobel on an array of all zeros"""
     result = F.vsobel(np.zeros((10, 10)), np.ones((10, 10), bool))
     assert (np.all(result == 0))
Exemplo n.º 7
0
 def test_00_01_mask(self):
     """Vertical Sobel on a masked array should be zero"""
     np.random.seed(0)
     result = F.vsobel(np.random.uniform(size=(10, 10)),
                       np.zeros((10, 10), bool))
     assert (np.all(result == 0))
Exemplo n.º 8
0
 def test_00_00_zeros(self):
     """Vertical sobel on an array of all zeros"""
     result = F.vsobel(np.zeros((10, 10)), np.ones((10, 10), bool))
     assert (np.all(result == 0))