本文整理汇总了Python中skimage.morphology.selem.square函数的典型用法代码示例。如果您正苦于以下问题:Python square函数的具体用法?Python square怎么用?Python square使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了square函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_binary_opening
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: setUp
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: test_binary_dilation
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: test_non_square_image
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: test_square_selem
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: test_square_selem
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: test_binary_opening
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: test_non_square_image
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: test_binary_opening
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)