Beispiel #1
0
 def setUp(self):
     self.black_pixel = 255 * cp.ones((4, 4), dtype=cp.uint8)
     self.black_pixel[1, 1] = 0
     self.white_pixel = 255 - self.black_pixel
     self.selems = [
         selem.square(2),
         selem.rectangle(2, 2),
         selem.rectangle(2, 1),
         selem.rectangle(1, 2),
     ]
Beispiel #2
0
def test_non_square_image():
    strel = selem.square(3)
    binary_res = binary.binary_erosion(bw_img[:100, :200], strel)
    grey_res = img_as_bool(grey.erosion(bw_img[:100, :200], strel))
    testing.assert_array_equal(binary_res, grey_res)
Beispiel #3
0
def test_binary_opening():
    strel = selem.square(3)
    binary_res = binary.binary_opening(bw_img, strel)
    grey_res = img_as_bool(grey.opening(bw_img, strel))
    testing.assert_array_equal(binary_res, grey_res)
Beispiel #4
0
 def test_square_selem(self):
     """Test square structuring elements"""
     for k in range(0, 5):
         actual_mask = selem.square(k)
         expected_mask = cp.ones((k, k), dtype="uint8")
         assert_array_equal(expected_mask, actual_mask)