示例#1
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)
示例#2
0
 def setUp(self):
     self.black_pixel = 255 * np.ones((4, 4), dtype=np.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)]
示例#3
0
def test_binary_dilation():
    strel = selem.square(3)
    binary_res = binary.binary_dilation(bw_lena, strel)
    grey_res = img_as_bool(grey.dilation(bw_lena, strel))
    testing.assert_array_equal(binary_res, grey_res)
示例#4
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)
示例#5
0
 def test_square_selem(self):
     for k in range(0, 5):
         actual_mask = selem.square(k)
         expected_mask = np.ones((k, k), dtype="uint8")
         assert_equal(expected_mask, actual_mask)
示例#6
0
 def test_square_selem(self):
     """Test square structuring elements"""
     for k in range(0, 5):
         actual_mask = selem.square(k)
         expected_mask = np.ones((k, k), dtype='uint8')
         assert_equal(expected_mask, actual_mask)
示例#7
0
def test_binary_opening():
    strel = selem.square(3)
    binary_res = binary.binary_opening(bw_img, strel)
    with expected_warnings(['precision loss']):
        grey_res = img_as_bool(grey.opening(bw_img, strel))
    testing.assert_array_equal(binary_res, grey_res)
示例#8
0
def test_non_square_image():
    strel = selem.square(3)
    binary_res = binary.binary_erosion(bw_img[:100, :200], strel)
    with expected_warnings(['precision loss']):
        grey_res = img_as_bool(grey.erosion(bw_img[:100, :200], strel))
    testing.assert_array_equal(binary_res, grey_res)
示例#9
0
def test_binary_opening():
    strel = selem.square(3)
    binary_res = binary.binary_opening(bw_lena, strel)
    grey_res = grey.opening(bw_lena, strel)
    testing.assert_array_equal(binary_res, grey_res)