本文整理汇总了Python中skimage.morphology.grey.erosion函数的典型用法代码示例。如果您正苦于以下问题:Python erosion函数的具体用法?Python erosion怎么用?Python erosion使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了erosion函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_uint16
def test_uint16():
im16, eroded16, dilated16, opened16, closed16 = (
map(img_as_uint, [im, eroded, dilated, opened, closed]))
np.testing.assert_allclose(grey.erosion(im16), eroded16)
np.testing.assert_allclose(grey.dilation(im16), dilated16)
np.testing.assert_allclose(grey.opening(im16), opened16)
np.testing.assert_allclose(grey.closing(im16), closed16)
开发者ID:AceHao,项目名称:scikit-image,代码行数:7,代码来源:test_grey.py
示例2: test_selem_overflow
def test_selem_overflow():
strel = np.ones((17, 17), dtype=np.uint8)
img = np.zeros((20, 20), dtype=bool)
img[2:19, 2:19] = True
binary_res = binary.binary_erosion(img, strel)
grey_res = img_as_bool(grey.erosion(img, strel))
testing.assert_array_equal(binary_res, grey_res)
开发者ID:AbdealiJK,项目名称:scikit-image,代码行数:7,代码来源:test_binary.py
示例3: test_uint16
def test_uint16():
with expected_warnings(['Possible precision loss']):
im16, eroded16, dilated16, opened16, closed16 = (
map(img_as_uint, [im, eroded, dilated, opened, closed]))
np.testing.assert_allclose(grey.erosion(im16), eroded16)
np.testing.assert_allclose(grey.dilation(im16), dilated16)
np.testing.assert_allclose(grey.opening(im16), opened16)
np.testing.assert_allclose(grey.closing(im16), closed16)
开发者ID:AbdealiJK,项目名称:scikit-image,代码行数:8,代码来源:test_grey.py
示例4: test_selem_overflow
def test_selem_overflow():
strel = np.ones((17, 17), dtype=np.uint8)
img = np.zeros((20, 20))
img[2:19, 2:19] = 1
binary_res = binary.binary_erosion(img, strel)
with expected_warnings(['precision loss']):
grey_res = img_as_bool(grey.erosion(img, strel))
testing.assert_array_equal(binary_res, grey_res)
开发者ID:haohao200609,项目名称:Hybrid,代码行数:8,代码来源:test_binary.py
示例5: test_discontiguous_out_array
def test_discontiguous_out_array():
image = np.array([[5, 6, 2],
[7, 2, 2],
[3, 5, 1]], np.uint8)
out_array_big = np.zeros((5, 5), np.uint8)
out_array = out_array_big[::2, ::2]
expected_dilation = np.array([[7, 0, 6, 0, 6],
[0, 0, 0, 0, 0],
[7, 0, 7, 0, 2],
[0, 0, 0, 0, 0],
[7, 0, 5, 0, 5]], np.uint8)
expected_erosion = np.array([[5, 0, 2, 0, 2],
[0, 0, 0, 0, 0],
[2, 0, 2, 0, 1],
[0, 0, 0, 0, 0],
[3, 0, 1, 0, 1]], np.uint8)
grey.dilation(image, out=out_array)
testing.assert_array_equal(out_array_big, expected_dilation)
grey.erosion(image, out=out_array)
testing.assert_array_equal(out_array_big, expected_erosion)
开发者ID:AbdealiJK,项目名称:scikit-image,代码行数:20,代码来源:test_grey.py
示例6: test_compare_with_grey_erosion
def test_compare_with_grey_erosion():
# compare the result of maximum filter with erode
image = (np.random.rand(100, 100) * 256).astype(np.uint8)
out = np.empty_like(image)
mask = np.ones(image.shape, dtype=np.uint8)
for r in range(3, 20, 2):
elem = np.ones((r, r), dtype=np.uint8)
rank.minimum(image=image, selem=elem, out=out, mask=mask)
cm = grey.erosion(image=image, selem=elem)
assert_equal(out, cm)
开发者ID:AbdealiJK,项目名称:scikit-image,代码行数:12,代码来源:test_rank.py
示例7: test_dilate_erode_symmetry
def test_dilate_erode_symmetry(self):
for s in self.selems:
c = grey.erosion(self.black_pixel, s)
d = grey.dilation(self.white_pixel, s)
assert np.all(c == (255 - d))
开发者ID:AbdealiJK,项目名称:scikit-image,代码行数:5,代码来源:test_grey.py
示例8: test_float
def test_float():
np.testing.assert_allclose(grey.erosion(im), eroded)
np.testing.assert_allclose(grey.dilation(im), dilated)
np.testing.assert_allclose(grey.opening(im), opened)
np.testing.assert_allclose(grey.closing(im), closed)
开发者ID:AbdealiJK,项目名称:scikit-image,代码行数:5,代码来源:test_grey.py
示例9: test_binary_erosion
def test_binary_erosion():
strel = selem.square(3)
binary_res = binary.binary_erosion(bw_img, strel)
grey_res = img_as_bool(grey.erosion(bw_img, strel))
testing.assert_array_equal(binary_res, grey_res)
开发者ID:AbdealiJK,项目名称:scikit-image,代码行数:5,代码来源:test_binary.py
示例10: 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)
开发者ID:AbdealiJK,项目名称:scikit-image,代码行数:5,代码来源:test_binary.py
示例11: test_1d_erosion
def test_1d_erosion():
image = np.array([1, 2, 3, 2, 1])
expected = np.array([1, 1, 2, 1, 1])
eroded = grey.erosion(image)
testing.assert_array_equal(eroded, expected)
开发者ID:TheArindham,项目名称:scikit-image,代码行数:5,代码来源:test_grey.py
示例12: test_binary_erosion
def test_binary_erosion():
strel = selem.square(3)
binary_res = binary.binary_erosion(bw_img, strel)
with expected_warnings(['precision loss']):
grey_res = img_as_bool(grey.erosion(bw_img, strel))
testing.assert_array_equal(binary_res, grey_res)
开发者ID:haohao200609,项目名称:Hybrid,代码行数:6,代码来源:test_binary.py
示例13: test_binary_erosion
def test_binary_erosion():
strel = selem.square(3)
binary_res = binary.binary_erosion(bw_lena, strel)
grey_res = grey.erosion(bw_lena, strel)
testing.assert_array_equal(binary_res, grey_res)
开发者ID:GerardoLopez,项目名称:scikits-image,代码行数:5,代码来源:test_grey.py
注:本文中的skimage.morphology.grey.erosion函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论