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