本文簡要介紹 python 語言中 scipy.ndimage.sum_labels
的用法。
用法:
scipy.ndimage.sum_labels(input, labels=None, index=None)#
計算數組值的總和。
- input: array_like
將標簽定義的區域內的輸入值相加。
- labels: 數組 整數,可選
為數組的值分配標簽。必須具有與輸入相同的形狀。
- index: 數組,可選
被測物體的單個標簽號或一係列標簽號。
- sum: ndarray 或標量
由具有與索引相同形狀的標簽定義的區域內的輸入值總和的數組。如果 ‘index’ 為 None 或標量,則返回標量。
參數 ::
返回 ::
例子:
>>> from scipy import ndimage >>> input = [0,1,2,3] >>> labels = [1,1,2,2] >>> ndimage.sum_labels(input, labels, index=[1,2]) [1.0, 5.0] >>> ndimage.sum_labels(input, labels, index=1) 1 >>> ndimage.sum_labels(input, labels) 6
相關用法
- Python SciPy ndimage.spline_filter用法及代碼示例
- Python SciPy ndimage.shift用法及代碼示例
- Python SciPy ndimage.standard_deviation用法及代碼示例
- Python SciPy ndimage.sobel用法及代碼示例
- Python SciPy ndimage.spline_filter1d()用法及代碼示例
- Python SciPy ndimage.spline_filter1d用法及代碼示例
- 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用法及代碼示例
注:本文由純淨天空篩選整理自scipy.org大神的英文原創作品 scipy.ndimage.sum_labels。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。