Пример #1
0
 def test_01_01_horizontal(self):
     """Horizontal Sobel on an edge should be a horizontal line"""
     i, j = np.mgrid[-5:6, -5:6]
     image = (i >= 0).astype(float)
     result = F.hsobel(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))
Пример #2
0
 def test_01_01_horizontal(self):
     """Horizontal Sobel on an edge should be a horizontal line"""
     i, j = np.mgrid[-5:6, -5:6]
     image = (i >= 0).astype(float)
     result = F.hsobel(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))
Пример #3
0
 def test_01_02_vertical(self):
     """Horizontal Sobel on a vertical edge should be zero"""
     i, j = np.mgrid[-5:6, -5:6]
     image = (j >= 0).astype(float)
     result = F.hsobel(image)
     assert (np.all(result == 0))
Пример #4
0
 def test_00_01_mask(self):
     """Horizontal Sobel on a masked array should be zero"""
     np.random.seed(0)
     result = F.hsobel(np.random.uniform(size=(10, 10)),
                       np.zeros((10, 10), bool))
     assert (np.all(result == 0))
Пример #5
0
 def test_00_00_zeros(self):
     """Horizontal sobel on an array of all zeros"""
     result = F.hsobel(np.zeros((10, 10)), np.ones((10, 10), bool))
     assert (np.all(result == 0))
Пример #6
0
 def test_01_02_vertical(self):
     """Horizontal Sobel on a vertical edge should be zero"""
     i, j = np.mgrid[-5:6, -5:6]
     image = (j >= 0).astype(float)
     result = F.hsobel(image)
     assert (np.all(result == 0))
Пример #7
0
 def test_00_01_mask(self):
     """Horizontal Sobel on a masked array should be zero"""
     np.random.seed(0)
     result = F.hsobel(np.random.uniform(size=(10, 10)),
                       np.zeros((10, 10), bool))
     assert (np.all(result == 0))
Пример #8
0
 def test_00_00_zeros(self):
     """Horizontal sobel on an array of all zeros"""
     result = F.hsobel(np.zeros((10, 10)), np.ones((10, 10), bool))
     assert (np.all(result == 0))