コード例 #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))