本文简要介绍 python 语言中 scipy.ndimage.white_tophat
的用法。
用法:
scipy.ndimage.white_tophat(input, size=None, footprint=None, structure=None, output=None, mode='reflect', cval=0.0, origin=0)#
多维白色礼帽过滤器。
- input: array_like
输入。
- size: 整数元组
用于过滤器的扁平且完整的结构元素的形状。如果提供了足迹或结构,则可选。
- footprint: 整数数组,可选
用于白色顶帽过滤器的平面结构元素的元素位置。
- structure: 整数数组,可选
用于过滤器的结构元素。结构可以是非平面结构元素。
- output: 数组,可选
可以提供用于存储滤波器的输出的数组。
- mode: {‘reflect’, ‘constant’, ‘nearest’, ‘mirror’, ‘wrap’},可选
mode 参数确定如何处理数组边界,其中 cval 是 mode 等于 ‘constant’ 时的值。默认为‘reflect’
- cval: 标量,可选
如果模式为‘constant’,则填充过去输入边的值。默认值为 0.0。
- origin: 标量,可选
origin 参数控制过滤器的位置。默认值为 0。
- output: ndarray
输入结构过滤的结果。
参数 ::
返回 ::
例子:
从明亮的峰中减去灰色背景。
>>> from scipy.ndimage import generate_binary_structure, white_tophat >>> import numpy as np >>> square = generate_binary_structure(rank=2, connectivity=3) >>> bright_on_gray = np.array([[2, 3, 3, 3, 2], ... [3, 4, 5, 4, 3], ... [3, 5, 9, 5, 3], ... [3, 4, 5, 4, 3], ... [2, 3, 3, 3, 2]]) >>> white_tophat(input=bright_on_gray, structure=square) array([[0, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 1, 5, 1, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0]])
相关用法
- Python SciPy ndimage.correlate用法及代码示例
- Python SciPy ndimage.morphological_gradient用法及代码示例
- Python SciPy ndimage.variance用法及代码示例
- Python SciPy ndimage.correlate1d用法及代码示例
- Python SciPy ndimage.binary_dilation用法及代码示例
- Python SciPy ndimage.distance_transform_bf用法及代码示例
- Python SciPy ndimage.find_objects用法及代码示例
- Python SciPy ndimage.label用法及代码示例
- Python SciPy ndimage.maximum_filter1d用法及代码示例
- Python SciPy ndimage.iterate_structure用法及代码示例
- Python SciPy ndimage.map_coordinates()用法及代码示例
- Python SciPy ndimage.generic_laplace用法及代码示例
- Python SciPy ndimage.generate_binary_structure用法及代码示例
- Python SciPy ndimage.binary_opening用法及代码示例
- Python SciPy ndimage.binary_fill_holes用法及代码示例
- Python SciPy ndimage.maximum_filter用法及代码示例
- Python SciPy ndimage.minimum_position用法及代码示例
- Python SciPy ndimage.labeled_comprehension用法及代码示例
- Python SciPy ndimage.grey_erosion用法及代码示例
- Python SciPy ndimage.spline_filter用法及代码示例
- Python SciPy ndimage.shift用法及代码示例
- Python SciPy ndimage.distance_transform_cdt用法及代码示例
- Python SciPy ndimage.minimum用法及代码示例
- Python SciPy ndimage.fourier_uniform用法及代码示例
- Python SciPy ndimage.gaussian_laplace用法及代码示例
注:本文由纯净天空筛选整理自scipy.org大神的英文原创作品 scipy.ndimage.white_tophat。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。