本文整理汇总了Python中skimage.morphology.grey.opening函数的典型用法代码示例。如果您正苦于以下问题:Python opening函数的具体用法?Python opening怎么用?Python opening使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了opening函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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_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
示例3: _test_image
def _test_image(self, image):
with expected_warnings(['precision loss']):
result_opening = grey.opening(image, self.disk)
testing.assert_equal(result_opening, self.expected_opening)
with expected_warnings(['precision loss']):
result_closing = grey.closing(image, self.disk)
testing.assert_equal(result_closing, self.expected_closing)
开发者ID:haohao200609,项目名称:Hybrid,代码行数:8,代码来源:test_grey.py
示例4: test_3d_fallback_default_selem
def test_3d_fallback_default_selem():
# 3x3x3 cube inside a 7x7x7 image:
image = np.zeros((7, 7, 7), np.bool)
image[2:-2, 2:-2, 2:-2] = 1
opened = grey.opening(image)
# expect a "hyper-cross" centered in the 5x5x5:
image_expected = np.zeros((7, 7, 7), dtype=bool)
image_expected[2:5, 2:5, 2:5] = ndi.generate_binary_structure(3, 1)
testing.assert_array_equal(opened, image_expected)
开发者ID:AbdealiJK,项目名称:scikit-image,代码行数:11,代码来源:test_grey.py
示例5: test_2d_ndimage_equivalence
def test_2d_ndimage_equivalence():
image = np.zeros((9, 9), np.uint8)
image[2:-2, 2:-2] = 128
image[3:-3, 3:-3] = 196
image[4, 4] = 255
opened = grey.opening(image)
closed = grey.closing(image)
selem = ndi.generate_binary_structure(2, 1)
ndimage_opened = ndi.grey_opening(image, footprint=selem)
ndimage_closed = ndi.grey_closing(image, footprint=selem)
testing.assert_array_equal(opened, ndimage_opened)
testing.assert_array_equal(closed, ndimage_closed)
开发者ID:AbdealiJK,项目名称:scikit-image,代码行数:15,代码来源:test_grey.py
示例6: test_open_white_pixel
def test_open_white_pixel(self):
for s in self.selems:
assert np.all(grey.opening(self.white_pixel, s) == 0)
开发者ID:AbdealiJK,项目名称:scikit-image,代码行数:3,代码来源:test_grey.py
示例7: test_open_black_pixel
def test_open_black_pixel(self):
for s in self.selems:
grey_open = grey.opening(self.black_pixel, s)
assert np.all(grey_open == self.black_pixel)
开发者ID:AbdealiJK,项目名称:scikit-image,代码行数:4,代码来源: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_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)
开发者ID:AbdealiJK,项目名称:scikit-image,代码行数:5,代码来源:test_binary.py
示例10: _test_image
def _test_image(self, image):
result_opening = grey.opening(image, self.disk)
testing.assert_equal(result_opening, self.expected_opening)
result_closing = grey.closing(image, self.disk)
testing.assert_equal(result_closing, self.expected_closing)
开发者ID:kif,项目名称:scikits-image,代码行数:6,代码来源:test_grey.py
示例11: 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)
开发者ID:haohao200609,项目名称:Hybrid,代码行数:6,代码来源:test_binary.py
示例12: 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)
开发者ID:GerardoLopez,项目名称:scikits-image,代码行数:5,代码来源:test_grey.py
注:本文中的skimage.morphology.grey.opening函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论