本文簡要介紹 python 語言中 scipy.ndimage.extrema
的用法。
用法:
scipy.ndimage.extrema(input, labels=None, index=None)#
計算標簽處數組值的最小值和最大值,以及它們的位置。
- input: ndarray
N-D 要處理的圖像數據。
- labels: ndarray,可選
輸入中的特征標簽。如果不是無,則必須與輸入的形狀相同。
- index: int 或整數序列,可選
要包含在輸出中的標簽。如果 None (默認),使用非零標簽的所有值。
- minimums, maximums: int 或 ndarray
每個特征中的最小值和最大值。
- min_positions, max_positions: 元組或元組列表
每個元組給出對應的最小值或最大值的N-D 坐標。
參數 ::
返回 ::
例子:
>>> import numpy as np >>> a = np.array([[1, 2, 0, 0], ... [5, 3, 0, 4], ... [0, 0, 0, 7], ... [9, 3, 0, 0]]) >>> from scipy import ndimage >>> ndimage.extrema(a) (0, 9, (0, 2), (3, 0))
可以使用標簽和索引指定要處理的特征:
>>> lbl, nlbl = ndimage.label(a) >>> ndimage.extrema(a, lbl, index=np.arange(1, nlbl+1)) (array([1, 4, 3]), array([5, 7, 9]), [(0, 0), (1, 3), (3, 1)], [(1, 0), (2, 3), (3, 0)])
如果沒有給出索引,則處理非零標簽:
>>> ndimage.extrema(a, lbl) (1, 9, (0, 0), (3, 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.extrema。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。