当前位置: 首页>>代码示例>>Python>>正文


Python ndimage.grey_dilation方法代码示例

本文整理汇总了Python中scipy.ndimage.grey_dilation方法的典型用法代码示例。如果您正苦于以下问题:Python ndimage.grey_dilation方法的具体用法?Python ndimage.grey_dilation怎么用?Python ndimage.grey_dilation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scipy.ndimage的用法示例。


在下文中一共展示了ndimage.grey_dilation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: damage_mask

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import grey_dilation [as 别名]
def damage_mask(mask, scale_factor, shift_absolute, shift_factor):
  assert not (shift_absolute != 0.0 and shift_factor != 0.0)
  mask = mask.astype("float32")

  if shift_absolute != 0.0:
    mask = shift_mask_speed_absolute(mask, max_speed=shift_absolute)
  elif shift_factor != 0.0:
    mask = shift_mask_speed_factor(mask, factor=shift_factor)

  if scale_factor != 0.0:
    scale = numpy.random.uniform(1 - scale_factor, 1 + scale_factor)
    mask = scale_mask(mask, scale)

  # dilation_size = 5
  # mask = grey_dilation(mask, size=(dilation_size, dilation_size, 1))
  return mask 
开发者ID:JonathonLuiten,项目名称:PReMVOS,代码行数:18,代码来源:MaskDamager.py

示例2: generate_weight_map

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import grey_dilation [as 别名]
def generate_weight_map(weight_map,heatmap):

    k_size = 3
    dilate = ndimage.grey_dilation(heatmap ,size=(k_size,k_size))
    weight_map[np.where(dilate>0.2)] = 1
    return weight_map 
开发者ID:protossw512,项目名称:AdaptiveWingLoss,代码行数:8,代码来源:utils.py

示例3: get_skeleton

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import grey_dilation [as 别名]
def get_skeleton(self):
        return ndi.grey_dilation(self.img_skl, size=2) 
开发者ID:OnionDoctor,项目名称:FCN_for_crack_recognition,代码行数:4,代码来源:FCN_CrackAnalysis.py

示例4: test_grey_dilation01

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import grey_dilation [as 别名]
def test_grey_dilation01(self):
        array = numpy.array([[3, 2, 5, 1, 4],
                                [7, 6, 9, 3, 5],
                                [5, 8, 3, 7, 1]])
        footprint = [[0, 1, 1], [1, 0, 1]]
        output = ndimage.grey_dilation(array,
                                                 footprint=footprint)
        assert_array_almost_equal([[7, 7, 9, 9, 5],
                              [7, 9, 8, 9, 7],
                              [8, 8, 8, 7, 7]], output) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:12,代码来源:test_ndimage.py

示例5: test_grey_dilation02

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import grey_dilation [as 别名]
def test_grey_dilation02(self):
        array = numpy.array([[3, 2, 5, 1, 4],
                                [7, 6, 9, 3, 5],
                                [5, 8, 3, 7, 1]])
        footprint = [[0, 1, 1], [1, 0, 1]]
        structure = [[0, 0, 0], [0, 0, 0]]
        output = ndimage.grey_dilation(array,
                             footprint=footprint, structure=structure)
        assert_array_almost_equal([[7, 7, 9, 9, 5],
                              [7, 9, 8, 9, 7],
                              [8, 8, 8, 7, 7]], output) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:13,代码来源:test_ndimage.py

示例6: test_grey_dilation03

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import grey_dilation [as 别名]
def test_grey_dilation03(self):
        array = numpy.array([[3, 2, 5, 1, 4],
                                [7, 6, 9, 3, 5],
                                [5, 8, 3, 7, 1]])
        footprint = [[0, 1, 1], [1, 0, 1]]
        structure = [[1, 1, 1], [1, 1, 1]]
        output = ndimage.grey_dilation(array,
                             footprint=footprint, structure=structure)
        assert_array_almost_equal([[8, 8, 10, 10, 6],
                              [8, 10, 9, 10, 8],
                              [9, 9, 9, 8, 8]], output) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:13,代码来源:test_ndimage.py

示例7: test_grey_opening01

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import grey_dilation [as 别名]
def test_grey_opening01(self):
        array = numpy.array([[3, 2, 5, 1, 4],
                                [7, 6, 9, 3, 5],
                                [5, 8, 3, 7, 1]])
        footprint = [[1, 0, 1], [1, 1, 0]]
        tmp = ndimage.grey_erosion(array, footprint=footprint)
        expected = ndimage.grey_dilation(tmp, footprint=footprint)
        output = ndimage.grey_opening(array,
                                                footprint=footprint)
        assert_array_almost_equal(expected, output) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:12,代码来源:test_ndimage.py

示例8: test_grey_opening02

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import grey_dilation [as 别名]
def test_grey_opening02(self):
        array = numpy.array([[3, 2, 5, 1, 4],
                                [7, 6, 9, 3, 5],
                                [5, 8, 3, 7, 1]])
        footprint = [[1, 0, 1], [1, 1, 0]]
        structure = [[0, 0, 0], [0, 0, 0]]
        tmp = ndimage.grey_erosion(array, footprint=footprint,
                                             structure=structure)
        expected = ndimage.grey_dilation(tmp, footprint=footprint,
                                               structure=structure)
        output = ndimage.grey_opening(array,
                             footprint=footprint, structure=structure)
        assert_array_almost_equal(expected, output) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:15,代码来源:test_ndimage.py

示例9: test_grey_closing02

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import grey_dilation [as 别名]
def test_grey_closing02(self):
        array = numpy.array([[3, 2, 5, 1, 4],
                                [7, 6, 9, 3, 5],
                                [5, 8, 3, 7, 1]])
        footprint = [[1, 0, 1], [1, 1, 0]]
        structure = [[0, 0, 0], [0, 0, 0]]
        tmp = ndimage.grey_dilation(array, footprint=footprint,
                                              structure=structure)
        expected = ndimage.grey_erosion(tmp, footprint=footprint,
                                              structure=structure)
        output = ndimage.grey_closing(array,
                              footprint=footprint, structure=structure)
        assert_array_almost_equal(expected, output) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:15,代码来源:test_ndimage.py

示例10: test_morphological_gradient01

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import grey_dilation [as 别名]
def test_morphological_gradient01(self):
        array = numpy.array([[3, 2, 5, 1, 4],
                                [7, 6, 9, 3, 5],
                                [5, 8, 3, 7, 1]])
        footprint = [[1, 0, 1], [1, 1, 0]]
        structure = [[0, 0, 0], [0, 0, 0]]
        tmp1 = ndimage.grey_dilation(array,
                             footprint=footprint, structure=structure)
        tmp2 = ndimage.grey_erosion(array, footprint=footprint,
                                              structure=structure)
        expected = tmp1 - tmp2
        output = numpy.zeros(array.shape, array.dtype)
        ndimage.morphological_gradient(array,
                footprint=footprint, structure=structure, output=output)
        assert_array_almost_equal(expected, output) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:17,代码来源:test_ndimage.py

示例11: test_morphological_gradient02

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import grey_dilation [as 别名]
def test_morphological_gradient02(self):
        array = numpy.array([[3, 2, 5, 1, 4],
                                [7, 6, 9, 3, 5],
                                [5, 8, 3, 7, 1]])
        footprint = [[1, 0, 1], [1, 1, 0]]
        structure = [[0, 0, 0], [0, 0, 0]]
        tmp1 = ndimage.grey_dilation(array,
                             footprint=footprint, structure=structure)
        tmp2 = ndimage.grey_erosion(array, footprint=footprint,
                                              structure=structure)
        expected = tmp1 - tmp2
        output = ndimage.morphological_gradient(array,
                                footprint=footprint, structure=structure)
        assert_array_almost_equal(expected, output) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:16,代码来源:test_ndimage.py

示例12: test_morphological_laplace01

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import grey_dilation [as 别名]
def test_morphological_laplace01(self):
        array = numpy.array([[3, 2, 5, 1, 4],
                                [7, 6, 9, 3, 5],
                                [5, 8, 3, 7, 1]])
        footprint = [[1, 0, 1], [1, 1, 0]]
        structure = [[0, 0, 0], [0, 0, 0]]
        tmp1 = ndimage.grey_dilation(array,
                              footprint=footprint, structure=structure)
        tmp2 = ndimage.grey_erosion(array, footprint=footprint,
                                              structure=structure)
        expected = tmp1 + tmp2 - 2 * array
        output = numpy.zeros(array.shape, array.dtype)
        ndimage.morphological_laplace(array, footprint=footprint,
                                     structure=structure, output=output)
        assert_array_almost_equal(expected, output) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:17,代码来源:test_ndimage.py

示例13: test_morphological_laplace02

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import grey_dilation [as 别名]
def test_morphological_laplace02(self):
        array = numpy.array([[3, 2, 5, 1, 4],
                                [7, 6, 9, 3, 5],
                                [5, 8, 3, 7, 1]])
        footprint = [[1, 0, 1], [1, 1, 0]]
        structure = [[0, 0, 0], [0, 0, 0]]
        tmp1 = ndimage.grey_dilation(array,
                             footprint=footprint, structure=structure)
        tmp2 = ndimage.grey_erosion(array, footprint=footprint,
                                              structure=structure)
        expected = tmp1 + tmp2 - 2 * array
        output = ndimage.morphological_laplace(array,
                                footprint=footprint, structure=structure)
        assert_array_almost_equal(expected, output) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:16,代码来源:test_ndimage.py

示例14: test_dilation_scalar_size

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import grey_dilation [as 别名]
def test_dilation_scalar_size(self):
        result = ndimage.grey_dilation(self.array, size=3)
        assert_array_almost_equal(result, self.dilated3x3) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:5,代码来源:test_ndimage.py

示例15: test_grey_dilation01

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import grey_dilation [as 别名]
def test_grey_dilation01(self):
        array = numpy.array([[3, 2, 5, 1, 4],
                             [7, 6, 9, 3, 5],
                             [5, 8, 3, 7, 1]])
        footprint = [[0, 1, 1], [1, 0, 1]]
        output = ndimage.grey_dilation(array, footprint=footprint)
        assert_array_almost_equal([[7, 7, 9, 9, 5],
                                   [7, 9, 8, 9, 7],
                                   [8, 8, 8, 7, 7]], output) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:11,代码来源:test_ndimage.py


注:本文中的scipy.ndimage.grey_dilation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。