用法:
skimage.segmentation.clear_border(labels, buffer_size=0, bgval=0, in_place=False, mask=None, *, out=None)
清除連接到標簽圖像邊框的對象。
- labels:(M[, N[, ..., P]]) int 或 bool 的數組
成像數據標簽。
- buffer_size:int 可選
檢查的邊框寬度。默認情況下,僅刪除與圖像外部接觸的對象。
- bgval:浮點數或 int 可選
清除的對象設置為此值。
- in_place:布爾型,可選
是否就地操作標簽數組。自 0.19 版起已棄用。請改用 out。
- mask:bool的ndarray,形狀相同圖片, 可選的。
圖像數據掩碼。標簽圖像中與掩碼的假像素重疊的對象將被刪除。如果定義,參數buffer_size 將被忽略。
- out:ndarray
與標簽形狀相同的數組,其中放置輸出。默認情況下,會創建一個新數組。
- out:(M[, N[, ..., P]]) 數組
具有清晰邊界的成像數據標簽
參數:
返回:
例子:
>>> import numpy as np >>> from skimage.segmentation import clear_border >>> labels = np.array([[0, 0, 0, 0, 0, 0, 0, 1, 0], ... [1, 1, 0, 0, 1, 0, 0, 1, 0], ... [1, 1, 0, 1, 0, 1, 0, 0, 0], ... [0, 0, 0, 1, 1, 1, 1, 0, 0], ... [0, 1, 1, 1, 1, 1, 1, 1, 0], ... [0, 0, 0, 0, 0, 0, 0, 0, 0]]) >>> clear_border(labels) array([[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 1, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]) >>> mask = np.array([[0, 0, 1, 1, 1, 1, 1, 1, 1], ... [0, 0, 1, 1, 1, 1, 1, 1, 1], ... [1, 1, 1, 1, 1, 1, 1, 1, 1], ... [1, 1, 1, 1, 1, 1, 1, 1, 1], ... [1, 1, 1, 1, 1, 1, 1, 1, 1], ... [1, 1, 1, 1, 1, 1, 1, 1, 1]]).astype(bool) >>> clear_border(labels, mask=mask) array([[0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 1, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]])
相關用法
- Python skimage.segmentation.active_contour用法及代碼示例
- Python skimage.segmentation.relabel_sequential用法及代碼示例
- Python skimage.segmentation.flood_fill用法及代碼示例
- Python skimage.segmentation.felzenszwalb用法及代碼示例
- Python skimage.segmentation.watershed用法及代碼示例
- Python skimage.segmentation.expand_labels用法及代碼示例
- Python skimage.segmentation.find_boundaries用法及代碼示例
- Python skimage.segmentation.random_walker用法及代碼示例
- Python skimage.segmentation.slic用法及代碼示例
- Python skimage.segmentation.flood用法及代碼示例
- Python skimage.segmentation.join_segmentations用法及代碼示例
- Python skimage.feature.graycomatrix用法及代碼示例
- Python skimage.color.lab2lch用法及代碼示例
- Python skimage.draw.random_shapes用法及代碼示例
- Python skimage.feature.blob_doh用法及代碼示例
- Python skimage.feature.blob_dog用法及代碼示例
- Python skimage.filters.unsharp_mask用法及代碼示例
- Python skimage.registration.optical_flow_tvl1用法及代碼示例
- Python skimage.filters.rank.noise_filter用法及代碼示例
- Python skimage.exposure.histogram用法及代碼示例
注:本文由純淨天空篩選整理自scikit-image.org大神的英文原創作品 skimage.segmentation.clear_border。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。