當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python skimage.feature.corner_peaks用法及代碼示例

用法:

skimage.feature.corner_peaks(image, min_distance=1, threshold_abs=None, threshold_rel=None, exclude_border=True, indices=True, num_peaks=inf, footprint=None, labels=None, *, num_peaks_per_label=inf, p_norm=inf)

在角測量響應圖像中找到峰值。

這與 skimage.feature.peak_local_max 的不同之處在於它抑製了具有相同累加器值的多個連接峰。

參數

image(M, N) ndarray

輸入圖像。

min_distanceint 可選

分離峰的最小允許距離。

**

skimage.feature.peak_local_max()

p_norm浮點數

使用哪個 Minkowski p-norm。應在 [1, inf] 範圍內。如果可能發生溢出,有限的大 p 可能會導致 ValueError。 inf 對應於切比雪夫距離,2 對應於歐幾裏得距離。

返回

outputndarray 或 ndarray 的布爾值
  • 如果 index =真:(行,列,...)峰坐標。
  • 如果 index =假: 布爾數組形狀像圖片, 峰值由 True 值表示。

注意

num_peaks 限製在連接峰抑製之前應用。要限製抑製後的峰值數量,請設置 num_peaks=np inf 和 post-process 此函數的輸出。

例子

>>> from skimage.feature import peak_local_max
>>> response = np.zeros((5, 5))
>>> response[2:4, 2:4] = 1
>>> response
array([[0., 0., 0., 0., 0.],
       [0., 0., 0., 0., 0.],
       [0., 0., 1., 1., 0.],
       [0., 0., 1., 1., 0.],
       [0., 0., 0., 0., 0.]])
>>> peak_local_max(response)
array([[2, 2],
       [2, 3],
       [3, 2],
       [3, 3]])
>>> corner_peaks(response)
array([[2, 2]])

相關用法


注:本文由純淨天空篩選整理自scikit-image.org大神的英文原創作品 skimage.feature.corner_peaks。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。