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